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!

Issue with inserting current timestamp into table

1006448Apr 30 2013 — edited Apr 30 2013
I have the following two tables:
TABLE1 (TS_COL1 TIMESTAMP(6))
TABLE2 (TS_COL2 TIMESTAMP(6))

Now in my application I am trying to execute the following steps:
#1. In TS_COL1 I am inserting current timestamp value (SYSTIMESTAMP)
#2. I am reading this timestamp value and inserting into a TS_COL2

In the first step when I read the timestamp value (from TS_COL1) it comes out as: 2013-04-30T20:41:46.428-04:00. Now when I try to insert this value into the second table, the query fails with the error: ORA-01843: not a valid month.

I then tried to convert the value as:
INSERT into TABLE2(TS_COL2) VALUES (to_timestamp('2013-04-30T20:41:46.428-04:00', 'YYYY-MM-DD"T"HH24:MI:SS.FF3'))

But even this query throws an error saying "date format picture ends before converting entire input".

Not sure if the issue is with the letter "T" coming in the timestamp. Please suggest how can I achieve this.

Note: I cannot merge these steps into a single step as step 1 and step 2 are part of different processes. Also note that both the cols in the two tables are of type TIMESTAMP(6).

Edited by: 1003445 on Apr 30, 2013 6:34 PM

Edited by: 1003445 on Apr 30, 2013 6:35 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 28 2013
Added on Apr 30 2013
2 comments
888 views