I have two tables TABLE1 and TABLE2 with identical structures. I need a trigger to copy a record after insert from TABLE1 to TABLE2. What's the proper SQL for this?
views:
85answers:
1
                +3 
                A: 
                
                
              Hi Owen,
this would work:
CREATE OR REPLACE TRIGGER copy_tab1_tab2_trg AFTER INSERT ON table1
   FOR EACH ROW
BEGIN
    INSERT INTO TABLE2 
       (col1, col2, ..., coln) 
    VALUES 
       (:NEW.col1, :NEW.col2, ..., :NEW.coln);
END;
                  Vincent Malgrat
                   2010-04-28 14:35:29
                
              Thanks!  It was that :NEW part that I was unsure of.
                  Owen
                   2010-04-28 14:49:13