Data implicit conversion examples: from char to number
SQL>
SQL> -- Implicit conversion examples.
SQL>
SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
2 n1 NUMBER;
3 cn1 VARCHAR2(10);
4 cn2 VARCHAR2(10);
5 BEGIN
6 -- Repeat the same example as above, but with numbers.
7 cn1 := '995';
8 n1 := cn1 + .99 ;
9 cn2 := n1;
10 DBMS_OUTPUT.PUT_LINE('CN1 = ' || cn1);
11 DBMS_OUTPUT.PUT_LINE('CN2 = ' || cn2);
12 END;
13 /
CN1 = 995
CN2 = 995.99
PL/SQL procedure successfully completed.
SQL>
SQL>
Related examples in the same category