This context menu item will generate triggers on all items in the 'Structure' folder that has
a table defined in column 'Table Name'. The triggers will be generated according
to the values in columns 'On Insert', 'On Update' and 'Trigger When' in the 'Structure'
folder + value of column 'Replication Mode' in the job header.
Trigger names will start with prefix 'RPL' + name of replication job + the letter
'T' concatenated with the sequence number in the 'Structure' folder .
This means that if you have defined a job with Job ID = SUPP_INFO, and have defined
tables names on structure item 10 and 30, following triggers will be generated :
RPL_SUPP_INFO_T10 and
RPL_SUPP_INFO_T30
If you want the trigger to fire under special conditions, you must enter a when-clause
in the appropriate column in the 'Structure' folder.
(f. ex <new.contract = 'XX'> ).
If the trigger should enter data to the log table (mode=Batch), a sequence number
is used as primary key.
The trigger will build an attribute string based on current views key columns.
The triggers will always have status DISABLED when generated, and you must ENABLE
the trigger from a RMB choice. Accordingly, all trigger must be DISABLED from another
RMB choice in order to stop replication.
(batch processing, the replication job must also be started as a background process)
CREATE OR REPLACE TRIGGER RPL_SUPP_INFO_T20 AFTER INSERT OR UPDATE ON SUPPLIER_INFO_ADDRESS_TAB FOR EACH ROW DECLARE log_seq_ intface_repl_out_log_tab.log_seq%TYPE; trigger_type_ intface_repl_out_log_tab.trigger_type%TYPE; key_attr_ intface_repl_out_log_tab.key_attr%TYPE; BEGIN SELECT Repl_log_Seq.NEXTVAL INTO log_seq_ FROM DUAL;
IF INSERTING THEN trigger_type_ := 'I'; ELSIF UPDATING THEN trigger_type_ := 'U'; END IF; Client_SYS.Clear_Attr(key_attr_); Client_SYS.Add_To_Attr('PARTY_TYPE', :new.PARTY_TYPE,key_attr_); Client_SYS.Add_To_Attr('SUPPLIER_ID', :new.SUPPLIER_ID,key_attr_); INSERT INTO intface_repl_out_log_tab ( log_seq, intface_name, structure_seq, pos, start_pos, key_attr, trigger_type, log_date, rowversion ) VALUES (log_seq_,'SUPP_INFO',20,20,20, key_attr_, trigger_type_, sysdate, sysdate ); END;
(instant processing, replication is starting as soon as the trigger is enabled)
CREATE OR REPLACE TRIGGER RPL_CUST_INFO3_T20
AFTER INSERT OR UPDATE ON CUSTOMER_INFO_ADDRESS_TAB FOR EACH ROW DECLARE log_seq_ intface_repl_out_log_tab.log_seq%TYPE; trigger_type_ intface_repl_out_log_tab.trigger_type%TYPE; key_attr_ intface_repl_out_log_tab.key_attr%TYPE; BEGIN SELECT Repl_log_Seq.NEXTVAL INTO log_seq_ FROM DUAL; IF INSERTING THEN trigger_type_ := 'I'; ELSIF UPDATING THEN trigger_type_ := 'U'; END IF; Client_SYS.Clear_Attr(key_attr_); Client_SYS.Add_To_Attr('CUSTOMER_ID', :new.CUSTOMER_ID,key_attr_); Client_SYS.Add_To_Attr('REPL_ID','CUST_INFO3',key_attr_); Client_SYS.Add_To_Attr('TRIGGER_TYPE', trigger_type_,key_attr_); Transaction_SYS.Deferred_Call( 'Intface_Repl_Maint_Util_API.Replic_Automatic_Batch_',key_attr_, Intface_Header_API.Get_Description('CUST_INFO3')); END;