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

Home -> Community -> Mailing Lists -> Oracle-L -> Fwd: Lock against Inserts

Fwd: Lock against Inserts

From: Bill Buchan <wbuchan_at_uk.intasys.com>
Date: Thu, 25 Jul 2002 10:28:45 -0800
Message-ID: <F001.004A2A1A.20020725102845@fatcity.com>

Aha! Just seen the DBMS_LOCK example in Thomas Kyte's book where he does pretty much what I need (i.e. request a lock on hash(123) before the transaction starts). Still requires setting up a trigger, which I'd hoped to avoid, but if you need to do it this way, it's gotta go in!

Thanks
- Bill.

>I have a transaction which issues LOCK TABLE <TABLE> IN EXCLUSIVE
>MODE. This is to prevent INSERTs during processing.
>
>However this is way too restrictive - we only need to restrict certain
>types of insert, eg. where col1 = 123.
>
>I can do something like SELECT * FROM TABLE WHERE col1 = 123 FOR UPDATE to
>prevent updates of existing rows of this type, but this will not block
>further inserts.
>
>I could set up an insert trigger to prevent these inserts, but I don't
>want to error: just wait until the transaction ends. This would appear to
>make the trigger code too complex - surely there is a way to do this just
>with simple locks?
>
>Any ideas much appreciated!
>
>Thanks
>- Bill.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Bill Buchan
  INET: wbuchan_at_uk.intasys.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Jul 25 2002 - 13:28:45 CDT

Original text of this message

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