Tranasction Counter [message #372558] |
Thu, 22 February 2001 04:51 |
Martin
Messages: 83 Registered: February 2000
|
Member |
|
|
Could you help me, I writing some stored procedure from SQL Server to Oracle. And I need some function in Oracle as @@trancount in SQL Server.
Help me please.
Kind regards Martin !
***************************************************
@@TRANCOUNT
Returns the number of active transactions for the current connection.
Syntax
@@TRANCOUNT
Return Types
integer
Remarks
The BEGIN TRANSACTION statement increments @@TRANCOUNT by 1. ROLLBACK TRANSACTION decrements @@TRANCOUNT to 0, except for ROLLBACK TRANSACTION savepoint_name, which does not affect @@TRANCOUNT. COMMIT TRANSACTION or COMMIT WORK decrement @@TRANCOUNT by 1.
****************************************************
|
|
|
Re: Tranasction Counter [message #372574 is a reply to message #372558] |
Fri, 23 February 2001 14:42 |
amarpatgiri
Messages: 11 Registered: December 2000
|
Junior Member |
|
|
There is no equivalent function or variable or ......... in Oracle. What you can do is something like the following:
Create a function as follows as user "SYS". Grant execute permission on the function to public and create a PUBLIC synonym for the function. Now you can execute the function to get the active transactions for the current user session.
CREATE OR REPLACE FUNCTION TransactionsInMySession
RETURN PLS_INTEGER IS
Trans PLS_INTEGER;
BEGIN
select count(1) INTO Trans from v$transaction where
ses_addr in ( select saddr from v$session
where username = ( select user from dual));
RETURN Trans;
END;
Hope this helps :-)
-amar
|
|
|
|