Insert date value along with the default date format : Date Default Format « Date Timezone « Oracle PL / SQL






Insert date value along with the default date format


SQL>
SQL> create table company_events (event_name    varchar2( 100 ),
  2                               event_date    date );

Table created.

SQL>
SQL> insert into company_events ( event_name, event_date )
  2                      values ( 'Event 1', TO_DATE( '2-DEC-2006', 'DD-MON-YYYY' ) );

1 row created.

SQL>
SQL> insert into company_events ( event_name, event_date )
  2                      values ( 'Event 2', SYSDATE )
  3
SQL> column event_name format a40
SQL>
SQL> select * from company_events;

EVENT_NAME                               EVENT_DAT
---------------------------------------- ---------
Event 1                                  02-DEC-06

SQL>
SQL> show parameters nls_date_format
ORA-00942: table or view does not exist


SQL>
SQL> insert into company_events ( event_name, event_date )
  2                      values ( 'Event 3',  DATE '2006-10-11' );

1 row created.

SQL>
SQL> select * from company_events;

EVENT_NAME                               EVENT_DAT
---------------------------------------- ---------
Event 1                                  02-DEC-06
Event 3                                  11-OCT-06

SQL>
SQL> drop table company_events;

Table dropped.

SQL>
SQL>
           
       








Related examples in the same category

1.Setting the Default Date Format
2.Proper use of default format mask
3.Default output of SYSDATE
4.Get NLS date format: V$NLS_Parameters
5.Simple Examples of Storing and Retrieving Dates
6.Use the DATE keyword to supply a date literal to the database