Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to convert any datatype to a number

Christine1111Dec 6 2005 — edited Dec 7 2005
Hi --
I have a query I'm writing, and for error-trapping purposes I want to convert whatever information I received in a bind variable into a number.

For instance, in my query:
SELECT TO_NUMBER('c') FROM dual

I get an error because 'c' is not a number. I'm usually expecting a number, but if for some reason I receive a character, I want to convert that character to a zero, and if I do receive a number I want it to retain its value. I hope this is clear!!!

Any suggestions are greatly appreciated.

Thanks,

Christine
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 4 2006
Added on Dec 6 2005
11 comments
496 views