Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Oralce BUG or feature???
I am using Oracle 7.3.3 on NT 4.
I have a table with a field of type VARCHAR(5). It has numerical values in it. I was trying to pad zeros at the front of it (e.g. 612 would become 0612), that's when I discovered this behaviour of LPAD function:
select LPAD(class_code, 4, '0') from tableName returns only the original value. For example 612 comes back as 612 and not 0612.
select LPAD(class_code, 4, 'A') from tableName returns nothing!
RPAD seems to work OK. I guess that internally Oracle is treating the numerical values as true number and not char.
How do I pad leading zero's in a varchar field?
Thanks.
Nasir (nnoor_at_cris.com)
Received on Fri Sep 25 1998 - 00:00:00 CDT
![]() |
![]() |