What is Pragma Autonomous transaction. It's Real time
Example
Answers were Sorted based on User's Feedback
Answer / maruthi
Pragma Autonomous Transaction is which is executed in the
execution of another transaction known as parent
transaction which is independent of it
or
the whole transaction splits in to two parts known as
parent& child will be independent of both but have the same
relationship
Is This Answer Correct ? | 36 Yes | 6 No |
Autonomous Transactions
Autonomous transactions allow you to leave the context of
the calling transaction, perform an independant transaction,
and return to the calling transaction without affecting it's
state. The autonomous transaction has no link to the calling
transaction, so only commited data can be shared by both
transactions.
The following types of PL/SQL blocks can be defined as
autonomous transactions:
• Stored procedures and functions.
• Local procedures and functions defined in a PL/SQL
declaration block.
• Packaged procedures and functions.
• Type methods.
• Top-level anonymous blocks.
The easiest way to understand autonomous transactions is to
see them in action. To do this, we create a test table and
populate it with two rows. Notice that the data is not commited.
CREATE TABLE at_test (
id NUMBER NOT NULL,
description VARCHAR2(50) NOT NULL
);
INSERT INTO at_test (id, description) VALUES (1,
'Description for 1');
INSERT INTO at_test (id, description) VALUES (2,
'Description for 2');
SELECT * FROM at_test;
ID DESCRIPTION
---------- --------------------------------------------------
1 Description for 1
2 Description for 2
2 rows selected.
SQL>
Next, we insert another 8 rows using an anonymous block
declared as an autonomous transaction, which contains a
commit statement.
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
FOR i IN 3 .. 10 LOOP
INSERT INTO at_test (id, description)
VALUES (i, 'Description for ' || i);
END LOOP;
COMMIT;
END;
/
PL/SQL procedure successfully completed.
SELECT * FROM at_test;
ID DESCRIPTION
---------- --------------------------------------------------
1 Description for 1
2 Description for 2
3 Description for 3
4 Description for 4
5 Description for 5
6 Description for 6
7 Description for 7
8 Description for 8
9 Description for 9
10 Description for 10
10 rows selected.
SQL>
As expected, we now have 10 rows in the table. If we now
issue a rollback statement we get the following result.
ROLLBACK;
SELECT * FROM at_test;
ID DESCRIPTION
---------- --------------------------------------------------
3 Description for 3
4 Description for 4
5 Description for 5
6 Description for 6
7 Description for 7
8 Description for 8
9 Description for 9
10 Description for 10
8 rows selected.
SQL>
The 2 rows inserted by our current session (transaction)
have been rolled back, while the rows inserted by the
autonomous transactions remain. The presence of the PRAGMA
AUTONOMOUS_TRANSACTION compiler directive made the anonymous
block run in its own transaction, so the internal commit
statement did not affect the calling session. As a result
rollback was still able to affect the DML issued by the
current statement.
Is This Answer Correct ? | 20 Yes | 1 No |
Answer / neelbhotra
in Pragma Autonomous transaction
one(parents) transaction execute another transaction(child)
n the parent transaction suspend temporaly, wait till the
child transaction get complete (commited) n then parent is
resume.
ex.
it is used in interface pogram to hold the error datas in
error table & commited there, and from interface table the
inserted data is rollback.
Is This Answer Correct ? | 21 Yes | 8 No |
A program must be written which accepts date parameter. The date parameter will accept data in the format DD/MM/YYYY. This data has to be validated and post validation, the following details have to be displayed for this date parameter 1. Input date must be defaulted to sysdate, It can be overridden by any other date. 2. Financial year should be displayed for this date parameter. Eg: If the input date is 30/11/2010, the financial year must be displayed as 1. From Date : 01-Aprr-2010 To Date: 31-Mar-2011 3. Calendar year and Calendar month must also be displayed. 4. The next payment cycle (say for EB), must be displayed based on this date parameter. 5. The previous payment must also be displayed based on this date.
Presently u are working in which version?
What is sca and how is it useful?
In thet custom.pll what are the events we can write.
Tell me some interface tables on ordermangement.
In oracle application how do you debug or trace errors?
How do you register report in oracle apps?
How can u populate data into po_headers_all segment2 column?
Hi Experts How to Create a purchase order without a requisition ?
6 Answers Amdocs, KPMG, Oracle,
Give a brief overview on OrderManagement.
Oracle E-Business suite?
How to print invoice from APPS(front end).if we have invoice number in hand with us???