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: to_number from a varchar field.

Re: to_number from a varchar field.

From: heyvaert <pol.heyvaert_at_acunia.com>
Date: Mon, 10 Feb 2003 13:02:55 +0100
Message-ID: <3E4794EF.2090007@acunia.com>


this is OK for a record where NULL is filled in, but when the record is filled with a string,an 'ORA-01722: invalid number' exception is thrown.

Pol

Norman Dunbar wrote:

> Try :
>
> select to_char(nvl(col1,'0')) from testtable;
>
> If the column is NULL, NVL will be replaced by a character '0' which
> to_number will convert to zero.
>
> Cheers,
> Norman.
>
> -------------------------------------
> Norman Dunbar
> Database/Unix administrator
> Lynx Financial Systems Ltd.
> mailto:Norman.Dunbar_at_LFS.co.uk
> Tel: 0113 289 6265
> Fax: 0113 289 3146
> URL: http://www.Lynx-FS.com
> -------------------------------------
>
>
Received on Mon Feb 10 2003 - 06:02:55 CST

Original text of this message

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