MySQL - 具有多个结果集的存储过程 [英] MySQL - Stored procedure with multiple result sets

查看:98
本文介绍了MySQL - 具有多个结果集的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个存储过程中使用了两个 select 语句,但它只返回单个 select 语句表,请建议我如何获取这两个表的记录集?

Am using two select statements in a stored procedure but it is returning only single select statement table,how to get the both tables record set please suggest me?

推荐答案

确保您使用的是 mysqli 扩展,以便能够从存储过程中获取多个结果资源 - 标准的 PHP mysql 接口不支持它.

Make sure you are using the mysqli extension in php to be able to get multiple result resources from stored procedures - the standard PHP mysql interface doesn't support it.

从现在离线的介绍来看,这似乎是对课程的一个很好的介绍,尤其是:

From a now offline introduction, this seems like a pretty good introduction to the class, especially:

首先,你不应该处理对存储过程的调用像往常一样返回结果集SQL 查询.原因是执行时,存储过程将给你两个结果集.一个与实际结果集和另一个发送存储的状态程序(OK/ERR).

First thing’s first, you shouldn’t treat calls to stored procedures which return a resultset as you would normal SQL queries. The reason being is that when executed, a stored procedure will give you two resultsets back. One with the actual resultset and another which sends the status of the stored procedure (OK/ERR).

这篇关于MySQL - 具有多个结果集的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆