【问题标题】:stored procedures, error #1312, CLIENT_MULTI_RESULTS flag存储过程,错误 #1312,CLIENT_MULTI_RESULTS 标志
【发布时间】:2011-01-31 17:35:40
【问题描述】:

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

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

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

经过一番谷歌搜索,我认为我需要设置标志“CLIENT_MULTI_RESULTS” - 我正在使用 java 应用程序从 JDBC 连接数据库,但找不到设置它的位置!

有什么建议吗?

【问题讨论】:

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


    【解决方案1】:

    试试这个

    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 ;
    

    【讨论】:

      猜你喜欢
      • 2011-02-19
      • 2013-03-28
      • 2017-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-01
      • 2016-02-08
      相关资源
      最近更新 更多