创建存储过程
create procedure p1()
BEGIN
select * from d1;
END
执行存储过程
call p1();
import pymysql
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='root123', db='userdb')
cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
# 执行存储过程
cursor.callproc('p1')
result = cursor.fetchall()
cursor.close()
conn.close()
print(result)
删除存储过程
drop procedure proc_name;