Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle Select/Insert Locking

Oracle Select/Insert Locking

From: M2 <m2_at_nowhere.com>
Date: Tue, 10 Feb 2004 04:15:37 GMT
Message-ID: <JVYVb.567$KW.36599@news.optus.net.au>


Hi,
I have an application that records when a user has read a message in a table that looks like so:

MESSAGE_ID
USERNAME The code that inserts into this table does a select prior to the insert to check that it won't try to do something that will cause a constraint violation (there's a PK on the two columns). This works fine most of the time but every now and again when really hitting the site you can get a problem. As far as I can tell the processes overlap so that one inserts in between the select and the insert .e.g

process 1 selects to see if cool for insert process 2 selects to see if cool for insert process 1 finds ok so inserts
process 2 finds ok so inserts

How can I block against this? I thought perhaps SELECT FOR UPDATE might be the key but it didn't seem to do much.

Matt. Received on Mon Feb 09 2004 - 22:15:37 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US