Ask questions via twitter! Message any question to @answers on twitter. We'll publish the question and send you a reply each time there's a new answer.
Next Question

Answered Question

 
 M¢25  Funded By Mahalo ? |  August 09, 2009 05:42 AM

How to add commit inside of trigeer?

Dear friend i want to know how to use commit inside of trigger in oracle 9i??
Interesting Question?  Yes (0)   No (0)   
RSS
 
 

Best Answer  Decided by Votes

 
September 10, 2009 01:40 PM
Yes ,You can Commit inside the trigger.

But for this you have to make this trigger transaction to be a Independent transaction from its parent transaction, You can do this by using Pragma. Pragma AUTONOMOUS_TRANSACTION allow you to build the Indepadent(child) Transaction,started by another. Shold be declare in DECLARE section of any subprogram.

Used to make Modular and Resuable Blocks
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;


Helpful Answer?  (0)   (0)    Tip vijayragavendran for this answer
Permalink | Report
   Reply  
 
 
 
September 11, 2009 05:43 AM
Thanks for the information! Keep up the great work!

Report
 
 

Answer this Question

How tips and payments work

This question has already been resolved. You may add an answer to it but you will not be eligible to win best answer or any associated tips.

Ask a Question


140 characters left
Top of Page
Buy Mahalo Dollars with Credit Card or PayPal

Top Members

This Week All Time
  • buddawiggi
    buddawiggi
    2nd Degree Black Belt
    26935 Points
    M$783.09 Earned
  • kty2777
    kty2777
    Purple Belt with a Brown Tip
    5400 Points
    M$199.92 Earned
  • opher
    opher
    Purple Belt
    4132 Points
    M$185.92 Earned
   See All
 

Most Popular Tags

mahalo(1587)
iphone(461)
music(459)
google(352)
food(314)
online(293)
beer(278)
money(262)
movies(254)
apple(250)
aotd(235)
health(217)
video(204)
dog(202)
free(201)
   See All
 

Categories

Welcome New Members


 
 
Mahalo Dollars are the currency of Mahalo Answers.

Each Mahalo Dollar costs $1.

Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More

 
 

Please log in to use this function.