SQL>
SQL>
SQL> -- Converting a character formatted as currency to an integer value.
SQL> DECLARE
2 myString VARCHAR2(20) := '$123,456.78';
3 myNumber NUMBER ;
4 BEGIN
5 myNumber := TO_Number(myString,'$999,999,999.99');
6 DBMS_OUTPUT.PUT_LINE('The converted number is: ' || myString);
7 DBMS_OUTPUT.PUT_LINE('Your commission at 6% is: ' || (myNumber*.06));
8 END;
9 /
The converted number is: $123,456.78
Your commission at 6% is: 7407.4068
PL/SQL procedure successfully completed.
SQL>
SQL>
|