Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oralce BUG or feature???

Oralce BUG or feature???

From: NNOOR <Nnoor_at_cris.com>
Date: 1998/09/25
Message-ID: <6uh220$f8u@chronicle.concentric.net>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US