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

Home -> Community -> Usenet -> c.d.o.server -> Re: I need help with a delete trigger

Re: I need help with a delete trigger

From: Matthew MacFarland <matthew_mac&*(^%farland_at_dril-quip.com>
Date: Mon, 5 Oct 1998 14:58:34 -0500
Message-ID: <6vb8d2$hfg$1@uuneo.neosoft.com>


Try after delete maybe, or just set the constraint to cascade deleltes and you won't need the trigger.

Matthew MacFarland
Dril-Quip
matthew_macfarland_at_dril-quip.com

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 Mon Oct 05 1998 - 14:58:34 CDT

Original text of this message

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