Monday, March 26, 2012

Forcing leading zero

How can I force a number to have leading zeros ?

select '123456' from dual;

I have try using TO_NUMBER :

select TO_NUMBER('123456','00999999') from dual;

But it doesn't seems to work. It will conserve the leading zeros but I want to add some.Hehe.. sorry I get it, I just have to use TO_CHAR instead of TO_NUMBER|||Thats the way it is :)

Greetz

Manfred Peter
(Alligator Company)
http://www.alligatorsql.com

No comments:

Post a Comment