Rollback

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aayushsinha2005
    New Member
    • Jan 2008
    • 3

    Rollback

    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
  • sakumar9
    Recognized Expert New Member
    • Jan 2008
    • 127

    #2
    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

    Working...