In order to pad a number with leading zero Teradata you can do as follows:
create set table my_table ,no fallback ,
no before journal,
no after journal,
checksum = default
( a integer )
primary index ( a );
insert into my_table select 25;
insert into my_table select 12345;
insert into my_table select 0;
select substr(
'00000' || cast( a as varchar(5) ),
characters( cast( a as varchar(5) ) ),
5 )
from my_table;
The relevant part lies in the use of the functions substr and characters.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment