Retrieve date type information from a table
CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
HIREDATE DATE);
INSERT INTO EMP VALUES (1, 'SMITH', TO_DATE('17-DEC-1980', 'DD-MON-YYYY'));
INSERT INTO EMP VALUES (2, 'ALLEN', TO_DATE('20-FEB-1981', 'DD-MON-YYYY'));
INSERT INTO EMP VALUES (3, 'WARD', TO_DATE('22-FEB-1981', 'DD-MON-YYYY'));
INSERT INTO EMP VALUES (4, 'JONES', TO_DATE('2-APR-1981', 'DD-MON-YYYY'));
INSERT INTO EMP VALUES (5, 'MARTIN',TO_DATE('28-SEP-1981', 'DD-MON-YYYY'));
SQL> select HIREDATE from emp;
HIREDATE
---------
17-DEC-80
20-FEB-81
22-FEB-81
02-APR-81
28-SEP-81
SQL>
The date value is displayed in the format of DD-MON-YY:
- DD is the day number,
- MON is the first three characters of the month in uppercase
- YY is the last two digits of the year.
A database administrator can change the default display format for dates by setting NLS_DATE_FORMAT
.
NLS_DATE_FORMAT
is an Oracle database format parameter.
Home »
Oracle »
Select »
Oracle »
Select »
Simple Select:
- Simple select statement
- Retrieve date type information from a table
- Retrieving All Columns from a Table
- ROWID:Row Identifiers
- ROWNUM:Row Numbers
- Arithmetic calculation
- Date Arithmetic
- Column Arithmetic
- Column Aliases
- Combining Column Using Concatenation
- distinct rows
Related: