Rem drv:
Rem
Rem $Header: emdb/source/oracle/sysman/emdrep/sql/db/latest/eval/eval_triggers.sql /st_emdbsa_11.2/1 2008/12/12 12:05:22 mvajapey Exp $
Rem
Rem eval_triggers.sql
Rem
Rem Copyright (c) 2003, 2008, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem eval_triggers.sql -
Rem
Rem DESCRIPTION
Rem
Rem
Rem NOTES
Rem
Rem
Rem MODIFIED (MM/DD/YY)
Rem mvajapey 11/17/08 - bug 5969745: remove hardcoded 'sysman'
Rem chyu 06/28/05 - New repmgr header impl
Rem rpinnama 06/12/04 - Remove SET ECHO
Rem yfeng 12/06/03 - use snap_time instead of snap-id
Rem yfeng 12/05/03 - Use snap_id to delete old snapshots
Rem nachen 11/25/03 - fix trigger
Rem ychan 10/09/03 - Fix bug 3180738
Rem yfeng 09/12/03 - yfeng_bug-3135720
Rem yfeng 09/11/03 - Created
Rem
CREATE OR REPLACE TRIGGER MGMT_SQL_METRIC_TR BEFORE
INSERT
OR UPDATE ON "MGMT_SQL_METRIC_HELPER" REFERENCING OLD AS OLD NEW AS
NEW FOR EACH ROW
BEGIN
IF (:new.TARGET_GUID IS NOT NULL AND :new.SNAP_TIME IS NOT NULL) THEN
DELETE FROM MGMT_SQL_EVALUATION
WHERE target_guid = :new.TARGET_GUID AND
COLLECTION_TIMESTAMP < :new.SNAP_TIME;
DELETE FROM MGMT_SQL_SUMMARY
WHERE target_guid = :new.TARGET_GUID AND
COLLECTION_TIMESTAMP < :new.SNAP_TIME;
DELETE FROM MGMT_SQL_PLAN
WHERE target_guid = :new.TARGET_GUID AND
COLLECTION_TIMESTAMP < :new.SNAP_TIME;
END IF;
END;
/
show errors;