Home » RDBMS Server » Server Administration » Tranasction Counter
Tranasction Counter [message #372558] Thu, 22 February 2001 04:51 Go to next message
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 Go to previous messageGo to next message
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
Re: Tranasction Counter [message #372580 is a reply to message #372574] Mon, 26 February 2001 02:18 Go to previous message
Martin Stufi
Messages: 6
Registered: February 2001
Junior Member
Thank's Amar
Previous Topic: running exe when value changes in Dbase
Next Topic: How much characters in varchar2 length 4000?
Goto Forum:
  


Current Time: Sat May 18 04:15:04 CDT 2024