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

Rollback whole procedure

Below is my procedure....
There is no table called "pratik" in my database so that the procedure give error.
so that exception is fire ......but it cant rollback 2 insert statement that is written above DDL statement...
Here i want to rollback the 2 insert statement also....

can any one help me.....
Plz

CREATE OR REPLACE procedure temp
as
begin
insert into t values(1);
insert into t values(2);
EXECUTE IMMEDIATE 'DROP TABLE PRATIK';
insert into t values(4);
EXCEPTION
WHEN OTHERS THEN
Rollback;
end;
Oct 11 '06 #1
3 5429
DDL commands are auto commit so when you are doing rollback it givs error.
thus u cant rollback those 2 insert statemnts.









Below is my procedure....
There is no table called "pratik" in my database so that the procedure give error.
so that exception is fire ......but it cant rollback 2 insert statement that is written above DDL statement...
Here i want to rollback the 2 insert statement also....

can any one help me.....
Plz

CREATE OR REPLACE procedure temp
as
begin
insert into t values(1);
insert into t values(2);
EXECUTE IMMEDIATE 'DROP TABLE PRATIK';
insert into t values(4);
EXCEPTION
WHEN OTHERS THEN
Rollback;
end;
Oct 18 '06 #2
DDL commands are auto commit so when you are doing rollback it givs error.
thus u cant rollback those 2 insert statemnts.
hi , Insert is not a DDL command.You cna rollback if you set save point after each Insert and rollback up to save point.


cheers
SN
Oct 20 '06 #3
Hi

U can't Rollback Above two insert Command Because Drop is Auto comit DDL
Command.
This is Possible to Rollback insert Command

CREATE OR REPLACE procedure temp
as
begin
insert into PRATIK values(4);
EXECUTE IMMEDIATE 'DROP TABLE PRATIK';
insert into t1 values(1);
insert into t1 values(2);
insert into PRATIK values(4);
EXCEPTION
WHEN OTHERS THEN
Rollback;
end;
Oct 24 '06 #4

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

Similar topics

1
by: anders_tung | last post by:
Hi, I have a procedure which will call 3 functions. First function will update a record. Second function will delete a record. Third function will insert a record. Each function will return...
3
by: level8 | last post by:
Hi, Everybody, I'm a Hungarian SQL user and I need a little help for SQL Server 7 ! I protect my table against bad data with a trigger. I use ROLLBACK and RAISERROR statement in this trigger....
0
by: Rick Razzano | last post by:
I am seeing some strange behavior in sql server. Running a procedure with a table variable, selecting from the table, and exiting the loop will cause a rollback statement to be issued (which you...
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...
0
by: Jim Heavey | last post by:
I have tested a procedure in TOAD and it functions as expected, meaning for this particular transaction it returns and error message and performs a rollback within the procedure. When I call...
8
by: Michael Paesold | last post by:
I just read this in the MySQL manual: (http://dev.mysql.com/doc/mysql/en/InnoDB_Error_handling.html) "Error handling in InnoDB is not always the same as specified in the SQL standard. According...
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...
0
by: minapatel | last post by:
I have the following procedure CREATE OR REPLACE procedure FOL_PURGE_CASES as /* type "SET SERVEROUTPUT ON" in sqlplus to debug !! */ cursor all_cases is cursor all_cases is ...
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: ...
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
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.