Converting a character to an integer value
SQL>
SQL> -- Converting a character to an integer value.
SQL> DECLARE
2 myString VARCHAR2(20) := '1997';
3 myNumber NUMBER ;
4 BEGIN
5 myNumber := TO_Number(myString,'9999');
6 DBMS_OUTPUT.PUT_LINE('The converted number is: ' || myNumber);
7 DBMS_OUTPUT.PUT_LINE('The converted number plus 10 is: ' || (myNumber+10));
8 END;
9 /
The converted number is: 1997
The converted number plus 10 is: 2007
PL/SQL procedure successfully completed.
SQL>
SQL>
Related examples in the same category