mrahman
mrahman

Reputation: 35

Using commit in Trigger in Oracle 11g

I have created the following trigger in oracle-

create or replace TRIGGER TODAY_TD_INSERT AFTER INSERT ON table1 
FOR EACH ROW
DECLARE
BEGIN             
  INSERT INTO table2 (col1
  ,col2
  ,col3
  ) 
  VALUES (:NEW.,col1
  ,:NEW.,col2
  ,:NEW.,col3
  );
END;

So if any data insert in table1 the same data is inserting in table 2 also. So my question is do i need commit the data in new table2 ? So far i know we cannot use commit from trigger.

Upvotes: 1

Views: 1321

Answers (1)

David Aldridge
David Aldridge

Reputation: 52346

No, you do not. The session that made the change to the table on which the trigger is placed issues the commit (or rollback), and that applies to all changes made by that session.

Upvotes: 1

Related Questions