Re: Help! Error ORA-4091 on trigger.

From: Vince Cross <bartok_at_bnr.ca>
Date: 23 Mar 1995 19:24:24 -0600
Message-ID: <3kt708$c46_at_crchha60.bnr.ca>


In article <D5wAvp.5Ep_at_bcstec.ca.boeing.com>, William Nunn <nunnw_at_bcstec.ca.boeing.com> wrote:
>Vince Cross (bartok_at_bnr.ca) wrote:
>: I am trying to implement an ON DELETE SET NULL rule through a trigger (since
>: Oracle doesn't yet support this directly). The scenario is this: Table B
>: has foreign key references to Table A. When I delete from Table A, I want to
>: set the references in Table B to NULL. Here is the trigger code:
 -
>: CREATE OR REPLACE TRIGGER trigger_name
>: BEFORE DELETE ON table_a
>: FOR EACH ROW
>: BEGIN
>: UPDATE table_b
>: SET fld_1 = NULL, fld_2 = NULL
>: WHERE fld_1 = :old.fld_1
>: AND fld_2 = :old.fld_2;
>: END;
>
>
>If I understand, you want to update the row(s) on table_b which relate to
>table_a (designated by :old.fld_1 and :old.fld_2).
>
>It may suffice to code the PRE-DELETE trigger with:
>
>UPDATE table_b
> SET fld_1 = NULL,
> fld_2 = NULL
> WHERE fld_1 = :old.fld_1
> AND fld_2 = :old.fld_2;
>

Uhh, maybe I missed something, but isn't that what I already have coded?

Vince

--
* disclaimer - My views respresent NT/BNR in every way, NOT!
* Please direct non-business email to VLCross_at_aol.com  (No, I'm not an idiot
         just because I have an aol account. Excessive drinking makes me one.)
* Work related stuff can go to bartok_at_bnr.ca
Received on Fri Mar 24 1995 - 02:24:24 CET

Original text of this message