SQL server varchar to Oracle date format

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Victoria
Participant
Posts: 21
Joined: Mon Nov 12, 2007 1:44 pm

SQL server varchar to Oracle date format

Post by Victoria »

Hi,
I have to read from SQL Server database a string which has a format 'MM/DD/YYYY HH:MI:SS PM', and save them as Date datatype in Oracle. How do I do that? I got errors when I tried the following:
1. SQL Server as Varchar - Oracle as Timestamp and used TO_DATE(:138, 'MM/DD/YYYY HH:MI:SS PM') during insertion
2. SQL Server as Timestamp - Oracle as Timestamp and used TO_DATE(:138, 'MM/DD/YYYY HH:MI:SS PM') during insertion
Thanks..
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Which part gave you errors - the reading from SQL server or the writing to Oracle? What was the error?
Victoria
Participant
Posts: 21
Joined: Mon Nov 12, 2007 1:44 pm

Post by Victoria »

One error is:
Abnormal termination of stage VRV_ORDERS_DRS..Transformer_24
detected

Or sometimes:
ORDERS_STG..Transformer_24: ORA-01830: date format picture ends before converting entire input string
-- probably because the SQL Server format is 'YYYY-MM-DD 00:00:00.000'
and the Oracle tries to convert using TO_DATE(:138, 'YYYY-MM-DD HH24:MI:SS')
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, that seems likely. You need to make sure that column #138 contains all the characters needed by the target database.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

For the second, you need to transform the SQL Server timestamp to conform to what Oracle is expecting, that or use your own sql with a matching 'date format picture'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply