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

Home -> Community -> Usenet -> c.d.o.server -> Re: Delete of child-entry locks father-table

Re: Delete of child-entry locks father-table

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: 5 Dec 2006 05:34:31 -0800
Message-ID: <1165325671.385510.154080@j72g2000cwa.googlegroups.com>


hasta_l3_at_hotmail.com wrote:
> Charles Hooper wrote :
> >
> > In the code, you wrote:
> > LOCK TABLE TEST_CONFIG IN EXCLUSIVE MODE NOWAIT;
> >
> > Then:
> > SELECT description, username
> > FROM TEST_CONFIG
> > WHERE VALIDFROM IS NULL;
> >
> > Why are you locking the full table? If you remove the full table lock
> > and the SELECT, then replace the SELECT with this, would it achieve the
> > desired results?
> > SELECT description, username
> > FROM TEST_CONFIG
> > WHERE VALIDFROM IS NULL
> > FOR UPDATE;
> >
>
> Without the LOCK TABLE, phantom reads may very well kill his code ....
>
> > SELECT description, username FROM TEST_CONFIG
> > WHERE VALIDFROM IS NULL;
>
> ...
>
> > UPDATE TEST_CONFIG
> > SET VALIDFROM = validfromdate
> > WHERE VALIDFROM IS NULL;
>
> (not saying that I like LOCK TABLE :-)

I wonder if the OP has investigated different transaction isolation levels?

An isolation level of SERIALIZABLE may be sufficient to completely eliminate the need to issue LOCK TABLE commands. I demonstrated this feature in a subject thread titled "column update order" on the comp.databases.oracle.misc group:
http://groups.google.com/group/comp.databases.oracle.misc/browse_thread/thread/b1475f7f301c403d/1d2a238f8439a578?lnk=st&q=&rnum=33#1d2a238f8439a578

This concept is demonstrated more thoroughly in chapter 7 of Tom Kyte's "Expert Oracle Database Architecture" book. His book also describes the use of the SELECT FOR UPDATE syntax that I posted in this thread.

Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc. Received on Tue Dec 05 2006 - 07:34:31 CST

Original text of this message

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