>>
>>set schema CAT1.SCHM;

--- SQL operation complete. 
>>obey TEST_6_2_2_6(set_up);
>>
>>INSERT INTO T1 VALUES (1,2);

--- 1 row(s) inserted. 
>>INSERT INTO T1 VALUES (2,3);

--- 1 row(s) inserted. 
>>INSERT INTO T1 VALUES (3,4);

--- 1 row(s) inserted. 
>>
>>---------------------------------
>>-- DEFINE TRIGGERS
>>---------------------------------
>>
>>
>>CREATE TRIGGER rt1
+>AFTER UPDATE ON T1
+>REFERENCING OLD AS oldR FOR EACH ROW
+>INSERT INTO T2 VALUES (oldR.a, oldR.b+1);

--- SQL operation complete. 
>>
>>---------
>>
>>CREATE TRIGGER rt2
+>AFTER UPDATE ON T1
+>FOR EACH ROW
+>INSERT INTO T1 (select * from T2);

--- SQL operation complete. 
>>
>>--------
>>
>>CREATE TRIGGER rt4
+>AFTER UPDATE ON T1
+>REFERENCING OLD AS oldR FOR EACH ROW
+>INSERT INTO T2 (select * from T1 where a = oldR.b);

--- SQL operation complete. 
>>
>>obey TEST_6_2_2_6(tests);
>>
>>------------------------------------------------------------------
>>--          TEST CASE
>>------------------------------------------------------------------
>>
>>UPDATE T1 SET b=b+1 where a<3;

--- 2 row(s) updated. 
>>
>>SELECT * FROM T1 ORDER BY a,b;

A            B            
-----------  -----------  

          1            3  
          1            3  
          1            3  
          2            4  
          2            4  
          2            4  
          3            4  

--- 7 row(s) selected. 
>> -- check result
>>
>>SELECT * FROM T2 ORDER BY a,b;

A            B            
-----------  -----------  

          1            3  
          2            4  
          2            4  
          2            4  
          2            4  
          3            4  

--- 6 row(s) selected. 
>> -- check result
>>
>>------------------------------------------------------------------
>>--           END
>>------------------------------------------------------------------
>>obey TEST_6_2_2_6(clean_up);
>>
>>DROP TRIGGER rt1;

--- SQL operation complete. 
>>DROP TRIGGER rt2;

--- SQL operation complete. 
>>DROP TRIGGER rt4;

--- SQL operation complete. 
>>obey clearTables2;
>>SET SCHEMA cat1.schm;

--- SQL operation complete. 
>>DELETE FROM tab1A;

--- 0 row(s) deleted. 
>>DELETE FROM tab1B;

--- 0 row(s) deleted. 
>>DELETE FROM T1;

--- 7 row(s) deleted. 
>>DELETE FROM T2;

--- 6 row(s) deleted. 
>>DELETE FROM T3;

--- 0 row(s) deleted. 
>>DELETE FROM T4;

--- 0 row(s) deleted. 
>>DELETE FROM T5;

--- 0 row(s) deleted. 
>>DELETE FROM T6;

--- 0 row(s) deleted. 
>>DELETE FROM T7;

--- 0 row(s) deleted. 
>>DELETE FROM T8;

--- 0 row(s) deleted. 
>>
>>DELETE FROM cat2.schm.tab2A;

--- 0 row(s) deleted. 
>>DELETE FROM cat2.schm.tab2B;

--- 0 row(s) deleted. 
>>DELETE FROM cat3.schm.tab3A;

--- 0 row(s) deleted. 
>>
>>-- delete from table (index_table tab1a_i2);
>>-- delete from table (index_table tab1b_i1);
>>-- delete from table (index_table cat3.schm.tab3a_i1);
>>-- delete from table (index_table t1_i1);
>>-- delete from table (index_table t1_i2);
>>-- delete from table (index_table t3_i2);
>>
>>
>>SET SCHEMA cat1.schm_alt;

--- SQL operation complete. 
>>DELETE FROM tab1A;

--- 0 row(s) deleted. 
>>DELETE FROM tab1B;

--- 0 row(s) deleted. 
>>DELETE FROM T1;

--- 0 row(s) deleted. 
>>DELETE FROM T2;

--- 0 row(s) deleted. 
>>DELETE FROM T3;

--- 0 row(s) deleted. 
>>DELETE FROM T4;

--- 0 row(s) deleted. 
>>DELETE FROM T5;

--- 0 row(s) deleted. 
>>DELETE FROM T6;

--- 0 row(s) deleted. 
>>DELETE FROM T7;

--- 0 row(s) deleted. 
>>DELETE FROM T8;

--- 0 row(s) deleted. 
>>
>>SET SCHEMA cat1.schm;

--- SQL operation complete. 
>>
>>
>>-- switch schemas
>>set schema CAT1.SCHM_ALT;

--- SQL operation complete. 
>>obey TEST_6_2_2_6(set_up);
>>
>>INSERT INTO T1 VALUES (1,2);

--- 1 row(s) inserted. 
>>INSERT INTO T1 VALUES (2,3);

--- 1 row(s) inserted. 
>>INSERT INTO T1 VALUES (3,4);

--- 1 row(s) inserted. 
>>
>>---------------------------------
>>-- DEFINE TRIGGERS
>>---------------------------------
>>
>>
>>CREATE TRIGGER rt1
+>AFTER UPDATE ON T1
+>REFERENCING OLD AS oldR FOR EACH ROW
+>INSERT INTO T2 VALUES (oldR.a, oldR.b+1);

--- SQL operation complete. 
>>
>>---------
>>
>>CREATE TRIGGER rt2
+>AFTER UPDATE ON T1
+>FOR EACH ROW
+>INSERT INTO T1 (select * from T2);

--- SQL operation complete. 
>>
>>--------
>>
>>CREATE TRIGGER rt4
+>AFTER UPDATE ON T1
+>REFERENCING OLD AS oldR FOR EACH ROW
+>INSERT INTO T2 (select * from T1 where a = oldR.b);

--- SQL operation complete. 
>>
>>obey TEST_6_2_2_6(tests);
>>
>>------------------------------------------------------------------
>>--          TEST CASE
>>------------------------------------------------------------------
>>
>>UPDATE T1 SET b=b+1 where a<3;

--- 2 row(s) updated. 
>>
>>SELECT * FROM T1 ORDER BY a,b;

A            B            
-----------  -----------  

          1            3  
          1            3  
          1            3  
          2            4  
          2            4  
          2            4  
          3            4  

--- 7 row(s) selected. 
>> -- check result
>>
>>SELECT * FROM T2 ORDER BY a,b;

A            B            
-----------  -----------  

          1            3  
          2            4  
          2            4  
          2            4  
          2            4  
          3            4  

--- 6 row(s) selected. 
>> -- check result
>>
>>------------------------------------------------------------------
>>--           END
>>------------------------------------------------------------------
>>
>>-- end logging
>>LOG;
