IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to check duplicate row insertion?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gopal Tripathi

New User


Joined: 16 Sep 2009
Posts: 15
Location: Hyd,Ind

PostPosted: Thu Aug 04, 2011 1:40 pm
Reply with quote

Is it possible when SELECTing WITH UR that duplicate rows might be returned if employee records are being updated on-line whilst the SELECT is being performed?

There is a select correlated subquery being performed on some tables(these are user tables).The result set from this is being inserted to a work table.

Sometimes while inserting it throws -803,and sometime it runs fine.Is there any way to predict the INSERT on the row not already existing in the work table.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Aug 04, 2011 2:12 pm
Reply with quote

Gopal,

with UR, basically you can select un-committed rows, not duplicates.

Quote:
Sometimes while inserting it throws -803,and sometime it runs fine.

Sometimes its throwing -803, because what you are trying to insert is considered as duplicate.
Sometimes it runs fine, because it is the first of its kind icon_biggrin.gif.

Tell us your column details and also let us know, how you are making that column unique like is it an identity column, does it reference any sequence object or you have a mechainsm in the program to make it unique.

Thanks,
Sushanth
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Aug 04, 2011 2:21 pm
Reply with quote

What ?
I don't think a select being used for insert is ever correlated.
How can you predict? you might be able to test with exists or something.
And what has this to do with updates while selecting UR? you'll need to explain that a bit in detail.
Back to top
View user's profile Send private message
BrantleyL

New User


Joined: 03 Jun 2010
Posts: 14
Location: Dallas TX

PostPosted: Thu Aug 04, 2011 7:18 pm
Reply with quote

You can also get a -803 on a duplicate unique index.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Duplicate several members of/in one l... JCL & VSAM 7
No new posts How to check whether who renamed the ... JCL & VSAM 3
Search our Forums:

Back to Top