Oracle query in DS job!!

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
its_me48
Participant
Posts: 33
Joined: Fri Apr 29, 2005 10:09 am

Oracle query in DS job!!

Post by its_me48 »

I am using OCI stage to insert/update rows in Oracle database. I am using update/insert query. I want to insert all rows but update all but 1 row. So in the OCI stage, I use user defined SQL

INSERT INTO <TABLE> (Col1, Col2, Col3, Col4) VALUES (:1,:2,TO_DATE(:3, 'YYYY-MM-DD HH24:MI:SS'),:4);
UPDATE <TABLE> SET Col1=:2,Col3=TO_DATE(:3, 'YYYY-MM-DD HH24:MI:SS') WHERE Col1=:1

As you can see, I don't want to update Col4 in the UPDATE statement... I thought this would work but DS/Oracle errors out saying illegal variable/number... But if put in Col4 in the update statement, it works fine..
How do I fix this? I don't want to update Col4 ...

Thanks much !!
mctny
Charter Member
Charter Member
Posts: 166
Joined: Thu Feb 02, 2006 6:55 am

Post by mctny »

is your col1 marked as a key column on your job? and is it also key on your database? if so, try to seperate inserts and updates into two links and use the same user defined queries but drop col4 for the update link

that should work
Thanks,
Chad
__________________________________________________________________
"There are three kinds of people in this world; Ones who know how to count and the others who don't know how to count !"
its_me48
Participant
Posts: 33
Joined: Fri Apr 29, 2005 10:09 am

Post by its_me48 »

Yep.. col1 is the primary key... I had to create 2 links for insert and update jobs.. Thanks all !!
Post Reply