Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
777 views
in Technique[技术] by (71.8m points)

stored procedures - MySQL error #2014 - Commands out of sync; you can't run this command now

I am using MySQL and I am defining a stored procedure like this:

delimiter ;;
Create procedure sp_test()

  select * from name_table;
end

When I try to execute that procedure I get this error:

#2014 - Commands out of sync; you can't run this command now 

What does this mean and what am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From Manual

C.5.2.14. Commands out of sync
If you get Commands out of sync; you can't run this command now in your client code, you are calling client functions in the wrong order.

This can happen, for example, if you are using mysql_use_result() and try to execute a new query before you have called mysql_free_result(). It can also happen if you try to execute two queries that return data without calling mysql_use_result() or mysql_store_result() in between.

This post (taken from here)

I've solved that problem. I use MySQL-Fron instead MySQL Query browser. And everything works fine.

makes me think that it's not a server or database problem but a problem in the tool you're using.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...