Datatype Conversions: Implicit Conversion : Data Type Conversion « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
  2    d1    DATE;
  3    cd1   VARCHAR2(10);
  4    cd2   VARCHAR2(10);
  5    n1    NUMBER;
  6    c_cn1   VARCHAR2(10);
  7    c_cn2   VARCHAR2(10);
  8  BEGIN
  9     cd1 := '15-Nov-99';
 10     d1 := cd1;
 11     cd2 := d1;
 12     DBMS_OUTPUT.PUT_LINE('CD1 = ' || cd1);
 13     DBMS_OUTPUT.PUT_LINE('CD2 = ' || cd2);
 14     c_cn1 := '995';
 15     n1 := c_cn1 + .99 ;
 16     c_cn2 := n1;
 17     DBMS_OUTPUT.PUT_LINE('c_cn1 = ' || c_cn1);
 18     DBMS_OUTPUT.PUT_LINE('c_cn2 = ' || c_cn2);
 19  END;
 20  /
CD1 = 15-Nov-99
CD2 = 15-NOV-99
c_cn1 = 995
c_cn2 = 995.99

PL/SQL procedure successfully completed.

SQL>








21.9.Data Type Conversion
21.9.1.Datatype Conversions: Implicit Conversion
21.9.2.Explicit Conversion