您是否尝试过选择其中一个结果集?
for result in cursor.stored_results(): people = result.fetchall()
即使您只有一个
SELECTstmt
,它也可能正在分配多个结果集。我知道在PHP的MySQLi存储过程中,这样做是为了允许INOUT和OUT变量返回(这又一次,您什么也没有,但是也许无论如何都在分配)。
我正在使用(正在运行)的完整代码是:
import mysql.connectorcnx = mysql.connector.connect(user='me',password='pw',host='localhost',database='mydb')cnx._open_connection()cursor = cnx.cursor()cursor.callproc("getperson",[1])for result in cursor.stored_results(): people=result.fetchall()for person in people: print personcnx.close()


