Converting number to character formatted as a numeric string
SQL> -- Converting number to character formatted as a numeric string.
SQL> DECLARE
2 myNumber NUMBER := 90210;
3 myChar VARCHAR2(21) ;
4 BEGIN
5 myChar := TO_CHAR(myNumber,'0000000000');
6 DBMS_OUTPUT.PUT_LINE('The employee ID is: ' || myChar);
7 END;
8 /
The employee ID is: 0000090210
PL/SQL procedure successfully completed.
SQL>
SQL>
Related examples in the same category