Hi All,
I have a problem in that I am getting error ORA-04091 in a trigger I am writing. I can see why I get it, but not how to get around it.
The basic idea is, I have a table which can have any amount of rows for a project. If a row is deleted, I want to check if there are any other rows in the table for that project. If there are not, then I want to delete all of the staff assigned to that project.
My code is as follows:
CREATE OR REPLACE TRIGGER
EPROJECT3.CBR_DEL_BACO
BEFORE DELETE
on EPROJECT3.baco_temp
REFERENCING NEW AS NEW old as old
FOR EACH ROW
DECLARE
v_count NUMBER(3);
BEGIN
v_count := 0;
SELECT count(projectid)
INTO v_count
FROM baco_temp
WHERE projectid =
ld.projectid;
dbms_output.put_line('count = ' || v_count);
IF v_count = 1
THEN
DELETE FROM projectroles_temp
WHERE projectid =
ld.projectid
AND groupid = 209;
DELETE FROM accesscontrol_temp
WHERE projectid =
ld.projectid;
END IF;
END;
So, when I delete a row, I'm not able to count how many rows are left in the table, which I really need to do!
I hope to get as quick and useful an answer as last time.
Thanks in advance!
Kenneth
I have a problem in that I am getting error ORA-04091 in a trigger I am writing. I can see why I get it, but not how to get around it.
The basic idea is, I have a table which can have any amount of rows for a project. If a row is deleted, I want to check if there are any other rows in the table for that project. If there are not, then I want to delete all of the staff assigned to that project.
My code is as follows:
CREATE OR REPLACE TRIGGER
EPROJECT3.CBR_DEL_BACO
BEFORE DELETE
on EPROJECT3.baco_temp
REFERENCING NEW AS NEW old as old
FOR EACH ROW
DECLARE
v_count NUMBER(3);
BEGIN
v_count := 0;
SELECT count(projectid)
INTO v_count
FROM baco_temp
WHERE projectid =
dbms_output.put_line('count = ' || v_count);
IF v_count = 1
THEN
DELETE FROM projectroles_temp
WHERE projectid =
AND groupid = 209;
DELETE FROM accesscontrol_temp
WHERE projectid =
END IF;
END;
So, when I delete a row, I'm not able to count how many rows are left in the table, which I really need to do!
I hope to get as quick and useful an answer as last time.
Thanks in advance!
Kenneth