Use timestamp as table column type and insert sysdate to it : Timestamp « Date Timezone « Oracle PL / SQL






Use timestamp as table column type and insert sysdate to it

 
SQL>
SQL> create table events (
  2        event_name         varchar2( 100 ),
  3        event_date         date,
  4        event_timestamp timestamp )
  5      /

Table created.

SQL>
SQL>
SQL> insert into events ( event_name, event_date, event_timestamp )
  2             values  ( 'COMPANY_EVENTS table', sysdate, sysdate );

1 row created.

SQL>
SQL>
SQL> column event_name      format a28
SQL> column event_date      format a18
SQL> column event_timestamp format a28
SQL>
SQL>
SQL> select event_name, to_char(event_date, 'DD-MON-YY HH24:MI:SS') event_date,event_timestamp
  2  from events;

EVENT_NAME                   EVENT_DATE         EVENT_TIMESTAMP
---------------------------- ------------------ ----------------------------
COMPANY_EVENTS table         10-JUN-08 21:03:00 10-JUN-08 09.03.00.000000 PM

SQL>
SQL> drop table events;

Table dropped.

SQL>
SQL>

 








Related examples in the same category

1.TIMESTAMP specifies a precision for the SECONDS field in a TIMESTAMP column (the DATE data type can only store whole seconds).
2.Use the Timestamp data type in a table and insert data
3.Compare data and timestamp
4.INSERT statement adds a row with the TIMESTAMP keyword to supply a datetime literals
5.Use the TIMESTAMP type to define a column in a table
6.TIMESTAMP WITH TIME ZONE type extends TIMESTAMP to allow you to store a time zone
7.TIMESTAMP(4) WITH TIME ZONE
8.Cast string to TIMESTAMP
9.Use TIMESTAMP to mark string in insert statement
10.TIMESTAMP WITH LOCAL TIME ZONE
11.Create a table with two columns: 'timestamp with time zone', 'c2 timestamp with local time zone'