473,385 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Transaction Control

I have to deal with a Stored procedure which is commiting the query after executing the query. I have to control the transaction at the application level with .NET. Hows it possible to control the transaction of this stored proc which is doing a commit inside its body...I cannot control the transaction's rollback or commit in the application with .NET's tran control as the decision of commit is being made at the stored proc level..Is there a solution to it?
Nov 18 '06 #1
1 1877
pragatiswain
96 Expert
If you change your SP as below, it will solve the problem. Again if you capture the return value in the program, you can understand if the SP executed successfully or failed. Again which SQL created problem. You can set out param of SP to capture STOO_ERRMSG to find out what is the ora error message.

CREATE OR REPLACE PROCEDURE PROC1
RETURN INTEGER
AS
STOO_SELCNT INTEGER;
STOO_ROWCNT INTEGER;
STOO_RETVAL INTEGER;
STOO_ERRMSG varchar2(1500);
BEGIN
SAVEPOINT TRAN1;
BEGIN
STOO_RETVAL := 0;
STOO_ROWCNT := 0;
UPDATE TABLE1 SET ID = ID + 1 WHERE NAME = 'EVENT';
STOO_ROWCNT := SQL%ROWCOUNT;
EXCEPTION WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('NO DATA FOUND');
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR:' || SQLCODE || '-' || SQLERRM);
STOO_ERROR := SQLCODE;
STOO_ERRMSG := SQLERRM;
STOO_RETVAL := 1; -- CUSTOMIZED ERROR CODE TO FIND WHICH SQL CREATED PROBLEM
ROLLBACK TO SAVEPOINT TRAN1;
END;
IF STOO_ROWCNT > 1 THEN
BEGIN
ROLLBACK TO SAVEPOINT TRAN1;
STOO_RETVAL := 2;
RETURN STOO_RETVAL;
END;
END IF;
IF (STOO_RETVAL = 0) THEN
COMMIT;
END IF;
RETURN STOO_RETVAL;
END PROC1;
/

Hope this helps
Nov 18 '06 #2

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

Similar topics

16
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
1
by: faris_idris | last post by:
Hello, we are using Oracle 9i for client and server and Powerbuilder 8.0.3. We have a database link between two databases, whenever I try to do a simple select, update or insert I get the following...
5
by: BashiraInTrouble | last post by:
Hi Friends, I have tried almost everything but I cant seem to shrink the transaction log. Executing DBCC SQLPERF(LOGSPACE) gives me this info: Database Log Size (MB) Log Space Used (%) ...
6
by: JohnO | last post by:
Hi Folks, I have an update trigger that fails (it inserts an audit table record) in some circumstances. This is causing the triggering transaction to fail and roll back. Is there any way to...
4
by: Rahul Anand | last post by:
Getting SQL Exception when trying to implement Connection based Trasaction using SQL Helper class. I am using the follwing function to execute my stored procs: -=-=-=- ExecuteScalar(ByVal...
3
by: Saket Mundra | last post by:
I have multiple web forms in my application. The user after logging on is directed to form1 where he enters information desired. Once finished he is directed to form2 and the same procedure goes on...
2
by: Christian Stooker | last post by:
Part one: ====== Hi ! I want to use SQLite database like the FireBird database: with big isolation level. What's that meaning ? I have an application that periodically check some input...
4
by: liming | last post by:
Hi, I know it's possible to have transactions with Typed DataSet, but I have yet to find an example of it. For example, I have two typed TableAdapter CommerceDataSet.xsd ...
2
by: Ryan Liu | last post by:
Hi, I have few db write and read to execute, so I use transaction. Is that a problem or is that a regular way that I only use transaction on some cmds only, and other cmds I do not use...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.