Use DATE type column
SQL>
SQL> create table MyTable (
2 event_name varchar2(100),
3 event_date date);
Table created.
SQL>
SQL> insert into MyTable ( event_name, event_date ) values ( 'Oracle', TO_DATE( '2-DEC-2001', 'DD-MON-YYYY' ) );
1 row created.
SQL>
SQL> insert into MyTable ( event_name, event_date ) values ( 'Sample code', SYSDATE );
1 row created.
SQL>
SQL> column event_name format a40
SQL>
SQL> select * from MyTable;
EVENT_NAME EVENT_DATE
---------------------------------------- ------------------
Oracle 02-DEC-01
Sample code 10-JUN-08
SQL> insert into MyTable (event_name, event_date) values ('World', TO_DATE( '2-DEC-2001', 'DD-MON-YYYY' ) );
1 row created.
SQL> insert into MyTable ( event_name, event_date ) values ( 'code', SYSDATE );
1 row created.
SQL>
SQL> show parameters nls_date_format
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_date_format string
SQL>
SQL> insert into MyTable ( event_name, event_date ) values ( '9i', DATE '2001-10-11' );
1 row created.
SQL>
SQL> select * from MyTable;
EVENT_NAME EVENT_DATE
---------------------------------------- ------------------
Oracle 02-DEC-01
Sample code 10-JUN-08
World 02-DEC-01
code 10-JUN-08
9i 11-OCT-01
SQL>
SQL> drop table MyTable;
Table dropped.
SQL>
Related examples in the same category