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

Home -> Community -> Usenet -> c.d.o.server -> Re: numbers in varchar2 field

Re: numbers in varchar2 field

From: Lothar Armbrüster <lothar.armbruester_at_t-online.de>
Date: Fri, 09 Jun 2006 18:46:18 +0200
Message-ID: <87wtbquvj9.fsf@prometeus.none.local>


hinerman_at_gmail.com writes:

> 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?
>

Hello hinerman,
I would suspect having blanks before or after the digits. You could try something like

select '"'||your_column||'"' from your_table where trim(your_column)='4231';

and see if there are blanks surrounding your digits. These could be corrected but you should also correct your application that it does not insert such values.

Hope that helps,
Lothar

-- 
Lothar Armbrüster  | lothar.armbruester_at_t-online.de
Hauptstr. 26       |
65346 Eltville     |
Received on Fri Jun 09 2006 - 11:46:18 CDT

Original text of this message

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