Can we use commit in trigger and cursors?

Showing Answers 1 - 7 of 7 Answers

Soumi

  • Jun 12th, 2006
 

Yes, you can fire 'commit' using autonomous transaction.

  Was this answer useful?  Yes

anjireddy

  • Jun 16th, 2006
 

no u cant give commit in triggers

  Was this answer useful?  Yes

srinivas

  • Dec 1st, 2006
 

No we can't use commit in triggers, But we can use commit in Cursors

Regards

srinivas

  Was this answer useful?  Yes

PARI

  • Mar 14th, 2007
 

NO we cannot use commit in triggers but  ya we can call a procedure in which commit is used but its not reccommended
pl/sql will not issue any error during compilation its only during  the execution of trigger ,it will give err message.

  Was this answer useful?  Yes

mohan kumar

  • Apr 9th, 2007
 

Yes We can use commit statement in triggers with 10G.

Here is example :

CREATE OR REPLACE TRIGGER t_trigger
AFTER INSERT ON t1 FOR EACH ROW

DECLARE
  PRAGMA AUTONOMOUS_TRANSACTION;
 i PLS_INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO i
  FROM t1;

  INSERT INTO t2
  VALUES
  (i);
  COMMIT;
END;
/

mohan

  • Apr 9th, 2007
 

CREATE OR REPLACE TRIGGER t_trigger
AFTER INSERT ON t1 FOR EACH ROW

DECLARE
  PRAGMA AUTONOMOUS_TRANSACTION;
 i PLS_INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO i
  FROM t1;

  INSERT INTO t2
  VALUES
  (i);
  COMMIT;
END;
/

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions