Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Insert of a new row by different users

409206Nov 17 2003 — edited Dec 4 2003
I want to insert a row only if the row doesn't exist yet. So I look for the row in the table and, if I don't find it, I will insert it. But what if another client is doing the same thing and, in the time between my select and my insert, he inserts the row? To summarize:

transaction 1 (me):
TIME1:select ... where id=10;
TIME4:"if no rows"
����insert

trans2:
TIME2: select ... where id=10;
TIME3:"if no rows"
����insert

My insert (TIME4) will not work, even if I checked the existence of the row with the select (TIME1).
How can I avoid this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 1 2004
Added on Nov 17 2003
17 comments
455 views