title: Creating a back up table trigger in Oracle
body: <p>I have a table A which is constantly updated ( insert statements ) by one application. I want to create another table B which consists only few columns of table A. For this I thought of creating a trigger which triggered after insert on Table A, but I don't know how should I write the insert statement inside the trigger. I am not a database expert, so may be I am missing something simple. Please help. </p>
  
  <p>Here is my trigger code:</p>
  
  <pre><code>    CREATE OR REPLACE TRIGGER "MSG_INSERT_TRIGGER" 
  
  AFTER
  insert on "ACTIVEMQ_MSGS"
  
  DECLARE
  PRAGMA AUTONOMOUS_TRANSACTION;
  begin
  execute immediate 'truncate table MSG_BACKUP';
  insert into MSG_BACKUP select * from ACTIVEMQ_MSGS;
  COMMIT;
  end; 
  </code></pre>