On this page

    Categories: Conversion

    TO_NUMBER

    Converts a string into a number (double) in the specified format.

    Syntax

    TO_NUMBER(expression varchar, format varchar) → double

    • expression: String to convert to a number.
    • format: Format for number conversion.

    Examples

    TO_NUMBER example
    SELECT TO_NUMBER('12374.0023', '#####.###')
    -- 12374.002
    
    TO_NUMBER example
    SELECT TO_NUMBER('12374', '#####')
    -- 12374.0