Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> I need help with a delete trigger
Hi all,
I have the following problem about triggers.
For example, dept.deptno is a primary key, and emp.deptno is a foreign key
referring to dept.deptno.
I want to automatically delete all corresponding rows in emp when I delete a
row from dept. So I wrote:
create trigger delDept
before delete on dept
for each row
begin
delete from emp where deptno = :old.deptno; end;
When I tried to delete from dept it says table emp is constraining. The trigger can't modify it. But the only Fk on emp is the deptno. This was supposed to be straightforward. Any idea? Thanks. Please email to klam80_at_hotmail.com
Kevin
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Mon Oct 05 1998 - 14:37:03 CDT