Assign that date variable to another string : Date Type Convert « PL SQL Data Types « Oracle PL/SQL Tutorial






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

PL/SQL procedure successfully completed.








21.11.Date Type Convert
21.11.1.Use TO_CHAR in PL/SQL
21.11.2.Assign the string to a date variable. The conversion is implicit.
21.11.3.Assign that date variable to another string
21.11.4.Explicit declaration of format mask
21.11.5.Explicit declaration of format mask in where clause
21.11.6.Determine and display years and months