Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Conversion from string to number with a default value
Chandresh Prakash wrote:
> Hi,
> Does anyone know an sql function to convert a string to a number and if the
> string is not a number then converting to a default numeric value in Oracle.
> For example, something like to_number('234',-1) = 234 and
> to_number('34a',-1) = -1.
>
> Thanks in advance,
> Chandresh
You'll need to write your own function. But I'd take a good look at cast.
Go to: http://www.psoug.org/reference/library.html and click on CAST.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Sat May 29 2004 - 00:32:50 CDT
![]() |
![]() |