数据库
首页 > 数据库> > 20220501-day51:mysql存储过程

20220501-day51:mysql存储过程

作者:互联网

创建存储过程

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;

标签:存储,p1,pymysql,cursor,20220501,mysql,close,day51,conn
来源: https://www.cnblogs.com/willguke/p/16212507.html