Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: I need help with a delete trigger
Sorry! I tried this and donīt work. When I change the on delete cascade clause
at Schema Manager and apply the changes, Oracle automatically unchecks then
clause.
Anybody know whats happens?
Hi.
C. Mason wrote:
> Don't use a trigger. Recreate the foreign key on deptno using the ON DELETE
> CASCADE clause.
> klam80_at_my-dejanews.com wrote in message <6vb750$j8v$1_at_nnrp1.dejanews.com>...
> >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 Thu Oct 15 1998 - 05:35:02 CDT