Data Upsert in Oracle DB

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
mansoor_nb
Participant
Posts: 48
Joined: Wed Jun 01, 2005 7:10 am

Data Upsert in Oracle DB

Post by mansoor_nb »

Hi All,
I am repartitioning the data based on the columns Say A,B,C and sorting the incoming data on the columns A,B,C by using the sort stage. Then I am upserting the dat into the table XXX in the table which is in the Oracle DB. I am using the Upsert Mode to load the data into the table and the upsert options i have used is "Update Then Insert".The keys used for teh update is A,B,C.

The target table(Staging Table) will be empty.According to my knowledge if we use "Update then Insert", if the records are not found or if the target table is empty to update then it should be inserted into the table.

But the records are getting rejected and i am getting the SQL code as -1.I know the SQL code -1 is for unique key constraint violation, but there are no Duplicates in the Keys.

PLease Help.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Put a remove duplicates stage(and declare the keys) in between your sort stage and the Oracle stage and then run the job and see if it still gives the same error.

Also, in your target OCI stage, did you declare all your three columns as keys? Just double check.

HTH
Kris

Where's the "Any" key?-Homer Simpson
mansoor_nb
Participant
Posts: 48
Joined: Wed Jun 01, 2005 7:10 am

Post by mansoor_nb »

As i manetioned in my question, there are no duplicates coming in for the keys A,B,C.
I have checked my target Oracle stage,i have declared these three fields as keys.

Actually i am sorting on the 5 fields say A,B,C,D,E and while updating into the Oracle DB i am using only three key fields thais A,B,C. Is this causing an issue. :(
thumsup9
Charter Member
Charter Member
Posts: 168
Joined: Fri Feb 18, 2005 11:29 am

Post by thumsup9 »

Did you check if the Unique Constraint is having all the 5 keys included on the database side. How is the constraint defined on the table. If it has all the 5 keys then , yes it would be an issue using only 3 keys while loading as it may have duplicates on these 3 keys though not on 5 keys.
mansoor_nb
Participant
Posts: 48
Joined: Wed Jun 01, 2005 7:10 am

Post by mansoor_nb »

I have checked from DB side also.All the 5 keys have been included for the Unique constraint.But this is running fine in the QA environment. I am facing this issue in the Production environment.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

So what's different between the two environments?

"Nothing" is clearly not the correct answer.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mansoor_nb
Participant
Posts: 48
Joined: Wed Jun 01, 2005 7:10 am

Post by mansoor_nb »

There is no difference in both environment.Also the DBA has asked me to use Oracle Merger Parallel instead of Upsert.
I have not used this Oracle Merger earlier, can anybody help me out on how to use this Oracle Merger.

Please Help me out. :?
Post Reply