MySQL Forums
Forum List  »  MySQL Query Browser

Error Code: 2014 Commands out of sync; you can't run this command now
Posted by: Archana Chaudhary
Date: December 26, 2018 06:51AM

Hello All,

I got the error code 2014 when execute following procedure.

BEGIN
declare v_key varchar(50);
declare v_type varchar(50);
declare v_value varchar(50);
declare v_time bigint;
declare v_finished int;
declare var varchar(50);
declare c1 cursor for
select replace(key_,'"',''), replace(type,'"',''),replace(value,'"','') from configcsv;
DECLARE CONTINUE HANDLER FOR NOT found set v_finished =1;

DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
DECLARE EXIT HANDLER FOR 1062
BEGIN
ROLLBACK;
select concat ('Duplicat key for',v_value);
END;
DECLARE EXIT HANDLER FOR 45000
BEGIN
ROLLBACK;
RESIGNAL;
END;
set v_time = unix_timestamp(curdate());
OPEN C1;
get_order: LOOP
fetch c1 into v_key,v_type,v_value;
select concat(v_type,v_value);
If v_finished =1 THEN
LEAVE get_order;
END IF;
if v_key = '' then
set v_key = replace(lower(v_value),' ','');
end if;
select count(1) into var from ConstantConfiguration_test where configkey = lower(v_type)
;
if var = 0 and lower(v_type) <> "default" then
Select concat('No key for ',v_type);
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'No key for ';
else
insert into ConstantConfiguration_test(configkey,configtype,configvalue,createdon,deleted,modifiedon)
values (lower(v_key),lower(v_type),v_value,v_time,0,v_time);
end if;
END LOOP;
CLOSE C1;


when in configsv having 30 records it run smoothly if having 35 -45 records it start throughing error.

Not getting what is the issue.
Kindly help

Options: ReplyQuote


Subject
Written By
Posted
Error Code: 2014 Commands out of sync; you can't run this command now
December 26, 2018 06:51AM


Sorry, only registered users may post in this forum.

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.