Insert Multiple rows into a oracle table

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
balu536
Premium Member
Premium Member
Posts: 103
Joined: Tue Dec 02, 2008 5:01 am

Insert Multiple rows into a oracle table

Post by balu536 »

Hi All,

I am inserting the data into oracle table by using the odbc stage.

Say employee_name table,
There is after insert trigger on the employee_name table for inserting the data into the employee_sports table

ES_ID, Employee_name, Sports
ES_ID is primary key

This trigger works like below

For every new employee it inserts two records into the employee_sports like if we get 'A' then this table will have

1 A Soccer
2 A Baseball

New ES_ID is populated by fetching the maximum value of its ES_ID +1 and inserts a new record into table.

So i kept the options as below in the ODBC stage.

Isolation level=ReadCommitted
Record count=1
Array_Size=1
Auto Commit Mode on.

I ran job in parallel and kept a copy stage execution mode as 'SEQUENTIAL', before the odbc stage.

The job aborts and say that
I am getting a unique key violated constraint on the employee_sports.

Is there a problem with the job ?
Is there a problem for fetching the maximum value in the employee_sports?

Thanks in advance
karthikdsexchange
Participant
Posts: 15
Joined: Thu Aug 07, 2008 2:56 am

Re: Insert Multiple rows into a oracle table

Post by karthikdsexchange »

The stage in sequential mode will wait till all records are processed and avaliable, then stage will process them and avaliable for next link. So you are using the copy stage with sequential mode. So it is using same ES_ID I guess. Use this as a tip.
Karthik
Make It Work Make It Right Make It Fast
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What is the primary key of the employee_sports table?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply