Oracle Crossedition Triggers
Version 12.1.0.1

General Information
Library Note This page has been updated for Oracle release 12cR1 and shown to be compatible in the Container DB.
Data Dictionary Objects
ALL_TRIGGERS DBA_TRIGGERS TRIGGER$
DBA_ERRORS_AE DBA_TRIGGER_ORDERING USER_TRIGGERS
DBA_OBJECTS_AE    
System Privileges
ALTER ANY TRIGGER CREATE TRIGGER DROP ANY TRIGGER
CREATE ANY TRIGGER    
 
CREATE
Create Forward Editioning Trigger CREATE OR REPLACE TRIGGER <trigger_name>
BEFORE <INSERT OR UPDATE OR DELETE>
ON <table_name>
FOR EACH ROW
<FORWARD CROSSEDITION [FOLLOWS <trigger_name>] |
 REVERSE CROSSEDITION [PRECEDES <trigger_name>]>
<ENABLE | DISABLE>
BEGIN
  <trigger_body_code>
END;
/
CREATE OR REPLACE TRIGGER Contacts_Fwd_Xed
BEFORE INSERT OR UPDATE ON Contacts_Table
FOR EACH ROW
FORWARD CROSSEDITION
DISABLE
BEGIN
  Set_First_And_Last_Name(:NEW.Name_1, :NEW.First_Name_2, :NEW.Last_Name_2);
  Set_Country_Code_And_Phone_No(:NEW.Phone_Number_1, :NEW.Country_Code_2, :NEW.Phone_Number_2);
END Contacts_Fwd_Xed;
/
Create Reverse Editioning Trigger CREATE OR REPLACE TRIGGER Contacts_Rvrs_Xed
BEFORE INSERT OR UPDATE ON Contacts_Table
FOR EACH ROW
REVERSE CROSSEDITION
DISABLE
BEGIN
  :NEW.Name_1 := :NEW.Last_Name_2||', '||:NEW.First_Name_2;
  :NEW.Phone_Number_1 :=
     CASE :New.Country_Code_2 WHEN '+1' THEN
       REPLACE(:NEW.Phone_Number_2, '-', '.')
     ELSE
       '011.'||LTRIM(:NEW.Country_Code_2, '+')||'.'|| REPLACE(:NEW.Phone_Number_2, '-', '.')
     END;
END Contacts_Rvrs_Xed;
/
FOLLOWS CLAUSE CREATE OR REPLACE TRIGGER follows_test
BEFORE INSERT OR UPDATE ON person_tab
FOR EACH ROW
FORWARD CROSSEDITION
FOLLOWS ebradmin.person_fwd_xed

ENABLE
BEGIN
  dbms_output.put_line('FOLLOWS_TEST');
END person_fwd_xed;
/
PRECEDES CLAUSE CREATE OR REPLACE TRIGGER precedes_test
BEFORE INSERT OR UPDATE ON person_tab
FOR EACH ROW
REVERSE CROSSEDITION
PRECEDES ebradmin.person_rev_xed

ENABLE
BEGIN
  dbms_output.put_line('PRECEDES_TEST');
END person_rev_xed;
/
 
ALTER
Alter Editioning Trigger Enable or Disable ALTER TRIGGER <trigger_name> <ENABLE | DISABLE>;
SELECT trigger_name, status
FROM user_triggers;

ALTER TRIGGER Contacts_Fwd_Xed DISABLE;

SELECT trigger_name, status
FROM user_triggers;

ALTER TRIGGER Contacts_Fwd_Xed ENABLE;

SELECT trigger_name, status
FROM user_triggers;
 
DROP
Drop Editioning Trigger DROP TRIGGER <trigger_name>;
DROP TRIGGER Contacts_Fwd_Xed;

Related Topics
DBMS_EDITIONS_UTILITIES
DDL Event Triggers
Editions
Editioning Demo 1
Editioning Demo 2
Editioning Demo 3
Editioning Demo 4
Editioning Demo 5
Editioning Demo 6
Editioning Demo 7
Editioning Views
Instead Of Triggers
SYS_CONTEXT Function
System Event Triggers
Table Triggers

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2014 Daniel A. Morgan All Rights Reserved