MySQL Forums
Forum List  »  Stored Procedures

Re: 2014 - commands out of sync; you can't run this command now
Posted by: chan ming chan
Date: July 26, 2013 12:59AM

After more investigation, I deleted the delete statement and just have one update in the stored procedure, I found the error code still occur when I call the stored procedure.

Any idea?


delimiter $$
DROP PROCEDURE IF EXISTS rollbackA$$

create procedure rollbackA(
IN p_fk_tender_id dec(20))

proc_label: BEGIN


DECLARE max_version_id dec;
DECLARE result_id int;
DECLARE row_cnt INT DEFAULT 0;

declare exit handler for sqlexception rollback;
declare exit handler for sqlwarning rollback;

SET autocommit=0;

START TRANSACTION;

UPDATE tbl_tender2_phase2_station_summary set tender_am_suggest_status=0 WHERE fk_tender_id = p_fk_tender_id;
SELECT row_count() INTO row_cnt;
if row_cnt < 1 then
SELECT 2; -- not record were delete
ROLLBACK;
end if;

COMMIT;


SELECT 0;

END $$
delimiter;

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.