Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / SQL Data Types
 

Storing and Retrieving Dates

By default, you can supply a date with the format DD-MON-YYYY to the database, where: DD is a two-digit day such as 05 MON is the first three letters of the month such as FEB YYYY is a four-digit year such as 1968 SQL> SQL> -- create demo table SQL> create table Employee(   2    ID                 VARCHAR2(4 BYTE) ,   3    First_Name         VARCHAR2(10 BYTE),   4    Last_Name          VARCHAR2(10 BYTE),   5    Start_Date         DATE,   6    End_Date           DATE,   7    Salary             Number(8,2),   8    City               VARCHAR2(10 BYTE),   9    Description        VARCHAR2(15 BYTE)  10  )  11  / Table created. SQL> SQL> -- prepare data SQL> insert into Employee(Start_Date) values ('05-FEB-2005')   2  / SQL> SQL> -- clean the table SQL> drop table Employee   2  / Table dropped.