mysql存储过程和函数

存储过程一般独立来执行
call procedure_name();
函数可以当作sql的一部分来执行
select * from blog where gmt_create = now();

注意事项:
DECLARE 语句要出现在其它语句之前

1.查看存储过程
show procedure status;
查看具体的创建语句
show create procedure name
2. 创建存储过程
delimiter //
create procedure hello()
begin
declare a varchar(10);
set a = ‘hello’;
select a;
end;
//
3. 删除存储过程
drop proceduer name
4. 调用
call hello();

函数

show function stauts;
show create function name
select hello();

posted @   叶常落  阅读(66)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
点击右上角即可分享
微信分享提示