Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

adding timezone information to a timestamp in sql

928518Apr 20 2015 — edited May 13 2015

Hi All,

I have 2 tables (A, B). Both the tables have timestamp columns. I am reading the timestamp from table A and querying the corresponding record from Table B.

Table A: 16.04.15 06:00:00,000000000

Table B: 16.04.15 06:00:00,000000000 +00:00

The problem is that the Table A record has no timezone info in the value, whereas Table B has +00:00 which represents the value in UTC.

I need to know how can I add the timezone info in the Table A value, while querying the record from Table B?

I am using the to_date('16.04.15 06:00:00,000000000') sql function to convert my string value of table A to a timestamp before querying it on Table B, but then since my system local timezone is CET, the default is applied to my Table A value, which consequently does not retrieve the Table B record as the mach is not found.

Important point is that I cannot change the Table A data, i.e. I cannot make 06:00:00,000000000 to 08:00:00,000000000 CET, in-order to make it equal to Table B "06:00:00,000000000 +00:00" UTC.

I want to add "timezone" information to my existing Table A value i.e. 06:00:00,000000000 +00:00 and then compare it with Table B 06:00:00,000000000 +00:00.

Can some please tell me how to do it? How to add timezone info on the fly within the query? to_date()?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2015
Added on Apr 20 2015
9 comments
3,242 views