SQL>
SQL> -- Implicit conversion examples.
SQL>
SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
2 d1 DATE;
3 cd1 VARCHAR2(10);
4 cd2 VARCHAR2(10);
5 BEGIN
6 cd1 := '15-Nov-61';
7 -- Now assign the string to a date variable. The conversion is implicit.
8 d1 := cd1;
9 -- Now assign that date variable to another string.
10 -- Again the conversion is implicit, but this time the conversion is
11 -- from a date to a string.
12 cd2 := d1;
13 -- Display the two character strings to show that they are the same.
14 DBMS_OUTPUT.PUT_LINE('CD1 = ' || cd1);
15 DBMS_OUTPUT.PUT_LINE('CD2 = ' || cd2);
16
17 END;
18 /
CD1 = 15-Nov-61
CD2 = 15-NOV-61
PL/SQL procedure successfully completed.
SQL>
|