DB2 stage Write method

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

DB2 stage Write method

Post by subrat »

I have a query on the DB2/UDB stage while loading into it with "Write" method.

1: Is the job going to failed if the same record already exist in the table?
2: If yes, Is there any option to ignore this inserting failure with 'Write' method?
3: Is it the same case with DS8 version as well or DS8 treat this differently?
debrujr
Participant
Posts: 56
Joined: Fri Jul 31, 2009 1:05 pm
Location: South

Post by debrujr »

I'm not following your question. The DB2 stage has a selection for which "Write Mode" you want to use. Insert, Update, Delete, Insert then Update, etc...

Are you concerned that it will error due to table constraints? If so then use an Insert then Update method OR if the table isn't too large join your input records to your table and then just insert those that do not match then do what you will with the others whether it be trash them or update existing.
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

Post by subrat »

Let me re-write my point

Lets there are some records coming from source which already exist in target table. I need only insert in the target table (not update).As DS dont have that feature to only insert so i used
Write method as UPSERT and in Update sql doing something like "1=2" so that it will not be update (as part of my need).

Now question arise, as 1=2 will do a full table scan, can i use a reject out of the DB2 target stage so the records already
present in target will be get rejected and i dont have to scan whole table as well

As this is an existing job i dont want to change the design in major(by putting look up....)
nitkuar
Participant
Posts: 46
Joined: Mon Jun 23, 2008 3:09 am

Post by nitkuar »

Hi Subrat,

If record is already present in your target table, then in anyway, table integrity constraints won't allow you to insert same record again in that table and you should get integrity constraint violation error in you job.

Thanks
Nitin
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

Post by subrat »

If we use Upsert, it wont throw any error though record is already present in target. It will reject that record instead
Nagalakshmi.Krishna
Participant
Posts: 11
Joined: Sat Feb 10, 2007 12:32 am

Post by Nagalakshmi.Krishna »

Use Write Method=Write and Write Mode=Append
Post Reply