hi,i want to know how to use rollback in a stored procedure,i have the syntaxes but i am not able to formulate them into a stored procedure.can anyone please help
Rollback
Collapse
X
-
Tags: None
-
You can directly use ROLLBACK command in the stored procedure.
Have a look at this example:
-- Create a stored procedure to create a table.
CREATE PROCEDURE test(INOUT s INTEGER)
BEGIN
CREATE TABLE ta (a INT);
IF (s = 0) THEN
COMMIT;
set s = 1;
ELSE
ROLLBACK;
set s = 0;
END IF;
END @
Let me know if you were looking at something else.
Thanks and Regards
---Sanjay
Comment