DB2 TO ORACLE TIMESTAMP

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
raj_konig
Participant
Posts: 67
Joined: Thu Dec 22, 2005 12:27 am

DB2 TO ORACLE TIMESTAMP

Post by raj_konig »

Hi,

Can any one help me in converting the db2 timestamp to oracle (ORAOCI9 STAGE) Timestamp.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

If your DB2 timestamp is in YYYY-MM-DD 24HH:MI:SS then no conversion is required. You can send it as it is.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
raj_konig
Participant
Posts: 67
Joined: Thu Dec 22, 2005 12:27 am

Post by raj_konig »

DSguru2B wrote:If your DB2 timestamp is in YYYY-MM-DD 24HH:MI:SS then no conversion is required. You can send it as it is.

The format of DB2 is yyyy-mm-dd hh24:mi:ss.msecs(6digits)
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What happens when you send it directly to oracle without any conversion? Do you get any errors/warnings? If yes, can you paste it here?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hack off the milliseconds if your Oracle target is a DATE datatype. You can leave them on if you have an appropriate TIMESTAMP datatype, however.
-craig

"You can never have too many knives" -- Logan Nine Fingers
raj_konig
Participant
Posts: 67
Joined: Thu Dec 22, 2005 12:27 am

Post by raj_konig »

DSguru2B wrote:What happens when you send it directly to oracle without any conversion? Do you get any errors/warnings? If yes, can you paste it here? ...
In the transformer i am keeping db2 datatype as timestamp and in oracle datatype as date.

The format in oracle should be mm/dd/yyyy hh:mi:ss AM/PM

when i ran the job as it is
iam getting the below error

db2cobr_orclcobr_TEST_1..Transformer_1: At row 4, link "DSLink4", while processing column "UPDATE_TS"
Value treated as NULL
Attempt to convert String value "2005-08-12 16:38:55.176710" to Date type unsuccessful

db2cobr_orclcobr_TEST_1..Transformer_1: ORA-01400: cannot insert NULL into ("SUMMARY"."CO_BR_DEP_TEMP_NEW"."UPDATE_TS")
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What if you chop off the milliseconds, does it work then?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
raj_konig
Participant
Posts: 67
Joined: Thu Dec 22, 2005 12:27 am

Post by raj_konig »

DSguru2B wrote:What if you chop off the milliseconds, does it work then?
I am getting the same errros
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Change the datatype to Timestamp in your job and ensure the stage generates the SQL. Do that, remove the milliseconds and then you'll be fine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
raj_konig
Participant
Posts: 67
Joined: Thu Dec 22, 2005 12:27 am

Post by raj_konig »

chulett wrote:Change the datatype to Timestamp in your job and ensure the stage generates the SQL. Do that, remove the milliseconds and then you'll be fine.
I am getting the following error

db2cobr_orclcobr_TEST_1..Transformer_1: ORA-01843: not a valid month.

Should i need to edit the sql in the stage?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, as a Timestamp with generated SQL there should be no problem if the DB2 timestamp is indeed in the format you say it is.

Post the TO_DATE() portion of your insert sql for this field.
-craig

"You can never have too many knives" -- Logan Nine Fingers
raj_konig
Participant
Posts: 67
Joined: Thu Dec 22, 2005 12:27 am

Post by raj_konig »

chulett wrote:No, as a Timestamp with generated SQL there should be no problem if the DB2 timestamp is indeed in the format you say it is.

Post the TO_DATE() portion of your insert sql for this field.
This is resolved.

Initially iam using the substring function its not working then i used left function.

Target iam using TIMESTAMP as DATATYPE and it is got resolved.

One more question is how to populate the current date with timestamp as above.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Use the Macro DSJobStartTimestamp.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply