存储过程,错误#1312,CLIENT_MULTI_RESULTS标志

时间:2010-03-25 13:27:41

标签: java mysql jdbc connection mysql-error-1312

我正在MySQL中编写返回值的存储过程;

CREATE PROCEDURE getCustomerById (id int)
BEGIN
 SELECT *
    FROM customer
 WHERE customer.id = id;
END;

我得到的错误是结果无法在给定的上下文中显示。

在一些谷歌搜索后,我认为我需要设置标志“CLIENT_MULTI_RESULTS” - 我使用Java应用程序从JDBC连接数据库,但无法找到设置它的位置!

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

试试这个

delimiter ;

drop procedure if exists getCustomerById;

delimiter #

create procedure getCustomerById
(
 in p_id int unsigned
)
begin
  select c.* from customer c where c.id = p_id;
end #

delimiter ;