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

Home -> Community -> Mailing Lists -> Oracle-L -> nowait cursors in triggers

nowait cursors in triggers

From: Connor McDonald <mcdonald.connor_at_gmail.com>
Date: Thu, 9 Jun 2005 13:21:30 +0800
Message-ID: <5e3048620506082221502102e3@mail.gmail.com>


Hi all,

Does anyone know of a restriction (documented or otherwise) that prohibits triggers from using 'for update nowait' cursors ?

Consider the following example:



SQL> create table T ( x number, y number );

Table created.

SQL> insert into T values (1,1);

1 row created.

SQL> insert into T values (2,1);

1 row created.

SQL> create or replace
  2 trigger TRG after delete on T
  3 declare
  4 cursor C is select * from t

  5     where y =3D 1
  6     for update NOWAIT;

  7 begin
  8 open c;
  9 end;
 10 /

Trigger created.

Session 1 then does the following:

SQL> set sqlprompt 'SES1> '
SES1> delete from t where x =3D 1;

1 row deleted.

Session 2 then tries to delete a different row, but the after-statement trigger will then try to get a nowait lock on both rows:

SQL> set sqlprompt 'SES2> '
SES2> delete from t where x =3D 2;

(waiting....waiting....)

Is this correct behaviour ? Why does ses2 not get a "ORA-00054: resource busy and acquire with NOWAIT specified"

Cheers
Connor

--=20
Connor McDonald
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D

email: connor_mcdonald_at_yahoo.com
web: http://www.oracledba.co.uk

"Semper in excremento, sole profundum qui variat"

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Jun 09 2005 - 01:26:34 CDT

Original text of this message

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