Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> ORA-06512 error during trigger execution
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;
Thanks for all your help!
Sean Received on Fri Jan 16 1998 - 00:00:00 CST
![]() |
![]() |