Date

DATE accepts date and time information. Date values may be stored as literals. Date literals are enclosed in single quotation marks. The default Oracle date format is defined by the parameter NLS_DATE_FORMAT. DATE type stores the century, four digits of a year, the month, the day, the hour in 24-hour format, the minute, and the second. By default the database uses the format DD-MON-YYYY to represent a date:

  • DD is a two-digit day, e.g., 05
  • MON is the first three letters of the month, e.g., FEB
  • YYYY is a four-digit year, e.g., 2012

CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL,
                      ENAME VARCHAR2(10),
                      HIREDATE DATE);

INSERT INTO EMP VALUES (1, 'SMITH', '17-DEC-1980');

SQL> select * from emp;

     EMPNO ENAME      HIREDATE
---------- ---------- ---------
         1 SMITH      17-DEC-80

SQL>
Home »
Oracle »
Data types » 

Date:
  1. Date
  2. Default Date format
  3. Date literal and Date keyword
  4. Date and Time
  5. Default Date Format
Related: