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: <hinerman_at_gmail.com>
Date: 9 Jun 2006 15:46:33 -0700
Message-ID: <1149893193.553663.36780@c74g2000cwc.googlegroups.com>


All,
There are no such spaces to trim from the data. I've decided to switch to using a number format on the column, instead of varchar2. The leading zeros are important because 0425 is different from, say, 425 in the system. However, after some investigation, I've found that there aren't any leading zeros, nor would there ever be, which is contrary to the original specs. Oh well. Thanks

Lothar Armbrüster wrote:
> 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 - 17:46:33 CDT

Original text of this message

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