开发者

stored procedures, error #1312, CLIENT_MULTI_RESULTS flag

开发者 https://www.devze.com 2022-12-24 20:08 出处:网络
i am writing开发者_如何学Go stored procedures in MySQL that return values; CREATE PROCEDURE getCustomerById (id int)

i am writing开发者_如何学Go stored procedures in MySQL that return values;

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

and i get the error that the results cannot be shown in the given context.

after some googling, i think that i need to set the flag "CLIENT_MULTI_RESULTS" - i am connecting the database from JDBC using a java app, but cant find where to set it!

any suggestions?


try this

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 ;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号