• Skip to primary navigation
  • Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql
You are here: Home / Oracle / function / TO_NUMBER Function in Oracle SQL – PLSQL

TO_NUMBER Function in Oracle SQL – PLSQL

November 6, 2012 by techhoneyadmin

The TO_NUMBER function in Oracle SQL / PLSQL is used to convert a string to a number data type

The Syntax for the TO_NUMBER function in Oracle SQL / PLSQL is:

SELECT TO_NUMBER(string1, [FORMAT_MASK], [NLS_LANGUAGE])
FROM table_name;

  • string1 is the string that has to be converted to number
  • FORMAT_MASK is optional; it is used to convert the string1 to number.
  • NLS_LANGUAGE is also optional and is used to convert the string1 to number.

Example 1:

SELECT TO_NUMBER('123.456',999.999)
FROM DUAL; 

Will return “123.456”


Example 2:

SELECT TO_NUMBER('123.4',999.9)
FROM DUAL;

Will return “123.4”


Example 3:

SELECT TO_NUMBER('123',999.9)
FROM DUAL;

Will return “123”


Filed Under: function Tagged With: how to use to_number function in oracle database query, how to use to_number function in oracle plsql, how to use to_number function in oracle sql, syntax and example of to_number function in oracle database query, syntax and example of to_number function in oracle plsql, syntax and example of to_number function in oracle sql, TONUMBERPLSQL, to_number function in oracle plsql, to_number function in oracle sql, using to_number function in oracle database query, using to_number function in oracle plsql, using to_number function in oracle sql

Copyright © 2023 · Parallax Pro on Genesis Framework · WordPress · Log in