Mega Code Archive

 
Categories / Oracle PLSQL / Date Timezone
 

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.