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 -> I need help with a delete trigger

I need help with a delete trigger

From: <klam80_at_my-dejanews.com>
Date: Mon, 05 Oct 1998 19:37:03 GMT
Message-ID: <6vb750$j8v$1@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:37:03 CDT

Original text of this message

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