René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
to_number [Oracle SQL] | ||
to_number(expr) to_number(expr,format) to_number(expr,format,'nls-param')
The behaviour of to_number can be influenced by setting the NLS_NUMERIC_CHARACTERS,
NLS_CURRENCY, NLS_DUAL_CURRENCY and NLS_ISO_CURRENCY NLS parameters.
If expr cannot be converted into a number, an ORA-06502 (or value_error)
is thrown. This makes it possible to check if a string is numeric.
Links
See also safe_to_number: which is a function that converts text safely to numbers if they are convertable and returns
null otherwise. That is, it prevents the ORA-01722: invalid number error which is thrown if to_number is passed a string that doesn't represent a number.
|