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

Home -> Community -> Usenet -> c.d.o.tools -> Cascading triggers: too many open cursors?

Cascading triggers: too many open cursors?

From: Gamma <gamma_at_clark.net>
Date: Thu, 05 Jul 2001 12:59:53 GMT
Message-ID: <dxZ07.12118$DW1.501132@iad-read.news.verio.net>

[Oracle8i]

I have three triggers created by the following statements:

create trigger delete1 after delete on table1 for each row begin
  delete from table2 where column1 = :old.column1; end;
.

/
create trigger delete2 after delete on table2 for each row begin
  delete from table3 where column1 = :old.column1; end;
.

/
create trigger delete3 after delete on table3 for each row begin
  delete from table4 where column1 = :old.column1; end;
.

/

In other words, cascading triggers. There are four tables named table1, table2, table3, and table4 all with (let's say) a single column named "column1". Assuming the tables have many rows in common, a typical delete from table1 will propagate to the other three.

The question is, how many cursors are opened by such a cascade? How many are open at once? I came up with 6: - one for each trigger
- one for each delete statement

The trouble is, my tests seem to indicate that it takes many more. If I set OPEN_CURSORS to 16 in init.ora, I get a "too many open cursors" error somewhere in the middle trigger(!).

I've been trying to find the answer to this problem for days, going through _Oracle8: The Complete Reference_ and the online docs, with little luck so far. Nothing spells out where all the cursors are coming from.

Any help would be greatly appreciated. The schema I'm designing is somewhat dynamic, and I need to know whether the above will work, or if OPEN_CURSORS would have to be set to a ridiculously high figure that makes this unworkable.

Another thing: if I make cascading insert triggers going in the other direction, they seem to work fine. Why?

In fact, if anyone knows of a way to trace through and find out when cursors are opening and what they're opening for, that'd be a big help.

-- 

Paul Brinkley
gamma_at_clark.net
Received on Thu Jul 05 2001 - 07:59:53 CDT

Original text of this message

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