473,473 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Pragma autonomous transaction

26 New Member
Hi Experts,

I want to know what is the use of pragma autonomous transaction in PL/SQL.

In which condition should we use this?

Please guide me with an example.

Thanks,
Dilip
Jun 13 '07 #1
5 14084
debasisdas
8,127 Recognized Expert Expert
Hi
dilippanda
Welcome to TSDN.

You have reached the right place for knowledge shairing.

Here you will find a vast resource of related topics and code.

Feel free to post more doubts/questions in the forum.

But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

It will help Experts in the forum in solving/underestanding your problem in a better way.

Please follow the posting guidelines in every new post/reply.
Jun 13 '07 #2
debasisdas
8,127 Recognized Expert Expert
The pragma instructs the PL/SQL compiler to establish a PL/SQL block as autonomous or independent.

You can put the autonomous transaction pragma anywhere in the declaration section of your PL/SQL block.Autonomous

Transaction is a feature of oracle 8i .when executed within an autonomous transaction, and you will have to include a COMMIT or ROLLBACK in your program.

With PRAGMA AUTONOMOUS_TRANSACTION , the transaction state maintained independently . Commit/Rollback of nested transaction will no effect the other transaction.
Jun 13 '07 #3
debasisdas
8,127 Recognized Expert Expert
example #1
=============

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE prgtest IS
  2.  
  3. PRAGMA AUTONOMOUS_TRANSACTION;
  4.  
  5. BEGIN
  6. INSERT INTO test (v1)  VALUES  ('value1t');
  7.  
  8. COMMIT;
  9. END prgtest;
  10.  
Jun 13 '07 #4
dilippanda
26 New Member
Hi,

Thanks for your useful input.
I would appreciate your input if you can explain me in which scenario should we use this pragma in our PL/SQL block.

Thanks,
Dilip
example #1
=============

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE prgtest IS
  2.  
  3. PRAGMA AUTONOMOUS_TRANSACTION;
  4.  
  5. BEGIN
  6. INSERT INTO test (v1)  VALUES  ('value1t');
  7.  
  8. COMMIT;
  9. END prgtest;
  10.  
Jun 13 '07 #5
Saii
145 Recognized Expert New Member
Hi,

Thanks for your useful input.
I would appreciate your input if you can explain me in which scenario should we use this pragma in our PL/SQL block.

Thanks,
Dilip

Generally we use autonomous transactions when we lneed to log any action in the porgram flow irrespective of the fact that main SQL executed successfully or not.
Jun 13 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Shri | last post by:
Can anybody tell me where i can find a detailed document on #pragma .... --shri
1
by: Gustavo L. Fabro | last post by:
Greetings! Going directly to the point: myclass.h: //-------------------------------------- #pragma managed //Forward declaration
4
by: Daniel Daoust | last post by:
Hi, knowing that "autonomous transaction" (Oracle concept of) are not yet implemented in PostgreSQL, has anyone found a work-around. I need to preserve database states from a potential rollback...
11
by: ramu | last post by:
HI, Can anyone tell me about pragma? And can u give an example of how to use it?
15
by: muttaa | last post by:
Hello all, I'm a beginner in C...May i like to know the difference between a #pragma and a #define.... Also,yet i'm unclear what a pragma is all about as i can find topics on it only in...
3
by: Fred Morrison | last post by:
Does DB2 have anything equivalent to Oracle's PRAGMA AUTONOMOUS_TRANSACTION that allows a stored procedure to BEGIN, COMMIT or ROLLBACK a totally independent transaction while possibly (but not...
1
AdusumalliGopikumar
by: AdusumalliGopikumar | last post by:
Where we can't use Autonomous transaction?
26
by: Rick | last post by:
I'm told that "#pragma once" has made it into the ISO standard for either C or C++. I can't find any reference to that anywhere. If it's true, do any of you have a reference I can use? ...
0
debasisdas
by: debasisdas | last post by:
PRAGMA:-Signifies that the statement is a pragma (compiler directive). Pragmas are processed at compile time, not at run time. They pass information to the compiler. A pragma is an instruction to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.