Great number formatting trick

An excellent use of Oracle’s inbuilt formatting function – much simpler than parsing the input and multiple concatenation operators:

SELECT TO_CHAR(0408211234, 'FM0000G000G000','nls_numeric_characters=.-') phone from dual;

PHONE
-------------
0408-211-234

SSN formatting with TO_CHAR

2 thoughts on “Great number formatting trick

Comments are closed.