Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: to_number fails?
stevie_deja_at_my-deja.com wrote:
>
> Hi,
> I've been racking my brain with this one for a while and
> can't come up with a good solution. Can anyone tell me
> why the following fails?
>
> SQL> select REQUEST, STATUS, QTYNEEDED from csr where
> 10 = to_number(to_char(QTYNEEDED));
>
> 10 =
> to_number(to_char(QTYNEEDED))
> *
> ERROR at line 2:
> ORA-01722: invalid number
>
> Table fields are all VARCHAR2s,
> and the only data in the QTYNEEDED fields are number 2, 4 & 10,
> nothing too difficult to convert. I've tried it without the
> to_char and it fails in just the same order.
>
> Thanks for any help,
> Steve K.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
You have a quantity that ain't a number...
try
select *
from table
where rpad(translate(qty,'0123456789','XXXXXXXXXX'),10,'X') !=
'XXXXXXXXX'
ie map all the numerics to X, pad out length of 10 and see what
remains...
--
"Some days you're the pigeon, and some days you're the statue." Received on Thu Aug 05 1999 - 07:12:53 CDT
![]() |
![]() |