Page 1 of 1

Oracle query in DS job!!

Posted: Thu May 17, 2007 1:12 pm
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 !!

Posted: Thu May 17, 2007 1:47 pm
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

Posted: Thu May 17, 2007 2:06 pm
by its_me48
Yep.. col1 is the primary key... I had to create 2 links for insert and update jobs.. Thanks all !!