Oracle TO_NUMBER Function Guide

The TO_NUMBER function in Oracle is used to convert a string or date into a numeric value.

Syntax:
TO_NUMBER(expression, format, nlsparams)

Parameters:

  1. The expression that needs to be converted into a number can be a string or a date.
  2. Format: Optional parameter that specifies the format of the input expression. If no format is specified, Oracle will automatically choose the appropriate format based on the data type of the expression.
  3. nlsparams: Optional parameters used to specify language environment settings.

Example:
SELECT CAST(‘12345’ AS NUMBER) AS result
FROM dual;

The above example converts the string ‘12345’ into a numeric value and outputs it as the result.

bannerAds