Keeping the old value on update

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
aravindk
Participant
Posts: 41
Joined: Tue Dec 09, 2003 8:59 am

Keeping the old value on update

Post by aravindk »

Hello all,

In one of my jobs, I am using Insert new or update existing rows. In that I want to move a field from my input stage only while inserting new rows. I want to keep the old value when it is updating an existing row. How can I do that?

Any help is much appreciated.

Regards,

Aravind.
nkumar_home
Participant
Posts: 19
Joined: Fri Apr 02, 2004 10:13 am

Post by nkumar_home »

Copy the sql generated by the "Insert new or update Existing rows" option.
Then change to "User defined sql". Paste the sql from above but make the changes to the update part to use the columns from the table instead of the host variables. This same mechanism can be used even if you want to add to an existing numeric column while updating.
aravindk
Participant
Posts: 41
Joined: Tue Dec 09, 2003 8:59 am

Post by aravindk »

I am using OCI8 stage and I dont see an option to convert into user-defined sql????
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The option is on the General page of the Inputs tab.

Better design is to segregate the rows to be inserted and updated so that one link can handle "insert new rows only" and the other link can handle "update existing rows only". In this case, preserve the original value in a column simply by not delivering that column to the "update" link.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
aravindk
Participant
Posts: 41
Joined: Tue Dec 09, 2003 8:59 am

Post by aravindk »

Thanks Ray. After pulling out my hairs for couple of hours, thats exactly what I ended up doing.

Thanks again,
Post Reply