Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple format question...

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want to format a query result to put zeros in front of the numbers, like '10' to '0010'. But the problem is: the field is alfanumeric because the numbers can be hex, so 'A01' must be '0A01'. I've tried to use the to_char function (ORACLE) but it didn't work with the letters.
 
Use the LPAD(expression,length,fill) function instead, ex:

select lpad(5,4,0) from dual

returns

0005

select lpad(5,4,'$') from dual

returns

$$$5

AA 8~)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top