Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: numbers in varchar2 field
<hinerman_at_gmail.com> wrote in message
news:1149825367.281761.22990_at_i40g2000cwc.googlegroups.com...
> I have a table with a varchar2(25) field. Most of the data in there is
> a 9 digit number, while a few records have 4 digit numbers. I have it
> as a varchar2 field to allow for some instances of leading zeros. My
> problem is that the 4 digit numbers aren't behaving like strings. If I
> query the table like where fieldName = '4231', it doesn't return any
> results. But if I query where fieldName = 4231, without the quotes, it
> returns results. Is there some reason these records are being handled
> differently?
>
Don't put numbers in character fields. Use to_char and a format to display
a number in a particular format.
Jim
Received on Thu Jun 08 2006 - 23:34:21 CDT