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

Home -> Community -> Usenet -> c.d.o.misc -> Re: ORA-06512 error during trigger execution

Re: ORA-06512 error during trigger execution

From: Matthias Gresz <GreMa_at_t-online.de>
Date: 1998/01/19
Message-ID: <69v5cn$3eu$1@news01.btx.dtag.de>#1/1

Hi Sean,

ORA-06512 just indicates that an error occured. The error number you've got to check for is ORA-20003.
We dealt a long time with oracle support to supress ORA_06512-messages when raising application errors, but it seems that you can't.

Sean Read wrote:
>
> I am receiving the following error messages when my trigger fails. I
> thought the user would only see the ORA-20003 error but ORA-06512 and
> ORA-04088 are returned as well. Below are the error messages:
>
> ORA-20003: Cannot add or change record. Referential integrity rules
> require a related record in table 'stfipstb'.
> ORA-06512: at "ALMIS.TRIG_BIUD_AREATYPE1", line 8
> ORA-04088: error during execution of trigger 'ALMIS.TRIG_BIUD_AREATYPE1'
>
>
> Now here is my trigger code:
>
> DECLARE RecordCount NUMBER;
> BEGIN
>
> /* PREVENT INSERTS AND UPDATES IF NO MATCHING KEY IN 'stfipstb' */
> IF (UPDATING AND :old.stfips != :new.stfips) OR INSERTING THEN
> SELECT COUNT(*) INTO RecordCount FROM stfipstb WHERE (stfipstb.stfips
> =
> :new.stfips);
> IF RecordCount = 0 THEN
> raise_application_error(-20003, 'Cannot add or change record.
> Referential integrity rules require a related record in table
> ''stfipstb''.');
> END IF;
> END IF;
>
> /* CASCADE UPDATES TO 'geog' */
> IF UPDATING AND :old.areatype != :new.areatype THEN
> UPDATE geog
> SET geog.areatype = :new.areatype
> WHERE geog.areatype = :old.areatype;
> END IF;
>
> /* CASCADE DELETES TO 'geog' */
> IF DELETING THEN
> DELETE FROM geog WHERE geog.areatype = :old.areatype;
> END IF;
> END;
>
> Why am I receiving an ORA-06512 error?
>
> Thanks for all your help!
>
> Sean
 

-- 
Regards

Matthias Gresz    :-)
Received on Mon Jan 19 1998 - 00:00:00 CST

Original text of this message

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