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 -> What Happens When You Try To Lock A Table That's Already Locked?

What Happens When You Try To Lock A Table That's Already Locked?

From: <john_galt29_at_my-deja.com>
Date: Thu, 21 Oct 1999 17:01:21 GMT
Message-ID: <7ungsv$a9q$1@nnrp1.deja.com>


... I suppose the obvious answer here is DEADLOCK. My REAL question is -

How can I get Oracle to throw an exception if it tries to lock a table that is already locked? What I am doing is, when I have a certain number of records, locking the table, creating a new table, copying the records there and then nuking the records in the old table. Thus, during this process I want to have an EXCLUSIVE lock on the table so:

· No other process can lock the table
· No other process can add records to this table, until it has been
emptied.

But after doing a simple test in 2 SQLPlus windows, I realized that if I tried to lock the same table twice it just hangs until I do a COMMIT for the first lock ...

That just doesn't help me ... I need to throw an exception so my app knows it's locked and sends an appropriate message.

Any takers?

Thanx.
John

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Oct 21 1999 - 12:01:21 CDT

Original text of this message

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