473,382 Members | 1,717 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,382 software developers and data experts.

Help ... Rollback Transaction

I am new to db2 and want to know more about rollback and exception handling....
I am using AS/400 operations navigator to write the stored procedures.

I am trying this by using SAVEPOING and ROLLBACK but no luck... please help me out.....
Declare exit handler for sqlexception set nerror = sqlcode;
insert into empmaster (empname) values('test');
set emp_id = identity_val_local();
savepoint a on rollback retain cursors;
insert into empdetails (empid, empaddress) values(emp_id,'add');
savepoint b on rollback retain cursors;
if nerror != 0 then

rollback to savepoint a;
end if;

I am calling the stored procedures from Java like
ex: CALL save_data('dd','ddd')
Jan 28 '08 #1
1 3126
sakumar9
127 Expert 100+
Try these links:

http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.apdv.java.doc/doc/cjvjdsvp.html

http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0003271.html
Feb 1 '08 #2

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

Similar topics

2
by: Alice | last post by:
Hi all, I have a problem with rollback segment. I am a beginner and do not have much knowledge of DBA. Anyways, the problem is there is a transaction of around 105 MB. This would not fit...
3
by: timmy_dale12 | last post by:
Hello Im am a sql newbie who has a question concerning triggers. Ive made this trigger: create trigger check_if_already_exists on users for insert ,update as begin begin transaction
1
by: Attiq ur Rehman | last post by:
Hello All, I'm trying to write a stored procedure which tracks the insert event in a Table A. When we insert something in Table A in Database 'FMDB', it inserts the same information in Table B...
3
by: Simon Harvey | last post by:
Hi everyone, I'm having a problem that I don't know how to sort. I am trying to execute a number of SQL stored procedures in a single transaction. However it always throughs an exception...
2
by: mahajan.sanjeev | last post by:
Hi, I am having problems with rollback using the SQLTransaction object. I am trying to insert records in two tables in a transaction. I want to rollback all the changes if any exception occurs...
2
by: Richard | last post by:
Hi, I have 1 dataset with 2 tables (Table1 as parent, Table2 as Child), 1 row in both the tables. I am updating it with a transaction. First parent then child. When child update fails, it raise...
1
by: jacob.miles | last post by:
Hello. I'm trying to wrap a function call in a transaction, but when I intentionally throw an exception in the middle of the function it doesn't actually roll back the transaction. The debug...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
7
by: Rich | last post by:
Hello, I have an SP that inserts data into a sqlserver table. If a condition is not met within the SP after the data has been inserted into the table, the SP will rollback the insert. If I...
2
by: Ian Boyd | last post by:
We're encountering a situation where we're encountering a deadlock, and someone's been made the deadlock victim. But after that, DB2 refuses to run any SQL, and instead we get the error message: ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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.