rules repository

G-9020 – Try to use a format model and NLS_NUMERIC_CHARACTERS in string to number conversion functions.

Converting from strings to numeric datatypes (using `to_number`, `to_binary_double`, `to_binary_float` or `cast` to any of those datatypes) rely on session NLS settings for `nls_numeric_characters`. Typically the input string is expected to have a given decimal- and group-separator, so it is best practice to specify `nls_numeric_characters` in the function call. However, this requires also setting a format model, which is a good idea but can require a very large format model with many 9's if you do not know the maximum length of the string. To avoid an inappropriate dependability on configurable NLS parameters, try to use both format model and `nls_numeric_characters` in the conversion function call. The exceptions can be if the input is known to always be integer with no decimal- or group-separator, or if you do not know the maximum number of digits **and** have control over the session `nls_numeric_characters` parameter.

Tags: Function Usage.

Quality area: Reliability. Severity: Critical. Fixing time: Local-medium.

No rule selected