0

Hi,
I deliberately do mistake on line INSERT INTO table2....... but, it still commits despite variable of rowcount is set to 0. How can solve it?

Thanks

BEGIN
DECLARE rowcount INT;					
INSERT INTO table1 ………					
SELECT row_count() INTO rowcount;

IF (rowcount=1) THEN
    SET rowcount=0;
    INSERT INTO table2 ……………..
    SELECT row_count() INTO rowcount;

    IF (rowcount=1) THEN
        COMMIT;
    ELSE
       ROLLBACK;
    END IF;
END IF;
END
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by ndowens
0

Hi,
I deliberately do mistake on line INSERT INTO table2....... but, it still commits despite variable of rowcount is set to 0. How can solve it?

Thanks

BEGIN
DECLARE rowcount INT;					
INSERT INTO table1 ………					
SELECT row_count() INTO rowcount;

IF (rowcount=1) THEN
    SET rowcount=0;
    INSERT INTO table2 ……………..
    SELECT row_count() INTO rowcount;

    IF (rowcount=1) THEN
        COMMIT;
    ELSE
       ROLLBACK;
    END IF;
END IF;
END

I believe it to be because you put SET rowcount=0;

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.