Use TIMESTAMP to mark string in insert statement : Timestamp « Date Timezone « Oracle PL / SQL






Use TIMESTAMP to mark string in insert statement

 
SQL>
SQL> create table MyTable (
  2      title   varchar2(100),
  3      phone   varchar2(20),
  4      place   varchar2(100),
  5      starts  timestamp with time zone);

Table created.

SQL>
SQL> insert into MyTable (title, phone, place, starts)
  2  values ('Sales', '999.123.4567', 'Washington',TIMESTAMP '2001-12-01 15:00:00.000000 EST');

1 row created.

SQL>
SQL> insert into MyTable (title, phone, place, starts)
  2  values ('Product', '000.123.4567', 'San Francisco',TIMESTAMP '2001-12-01 17:00:00.000000 PST');

1 row created.

SQL>
SQL> insert into MyTable (title, phone, place, starts)
  2  values ('Highlights', '111 1234 5678', 'London', TIMESTAMP '2001-12-01 20:00:00.000000 GMT');

1 row created.

SQL>
SQL> select dbtimezone from dual;

DBTIME
------
+00:00

SQL>
SQL> select title, phone
  2  from MyTable
  3  where starts = TIMESTAMP '2001-12-01 15:00:00.000000 -5:00';

TITLE                     PHONE
------------------------- --------------------
Sales                     999.123.4567
Highlights                111 1234 5678

SQL>
SQL>
SQL> drop table MyTable;

Table dropped.

 








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.TIMESTAMP WITH LOCAL TIME ZONE
10.Use timestamp as table column type and insert sysdate to it
11.Create a table with two columns: 'timestamp with time zone', 'c2 timestamp with local time zone'