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 @ 2022-03-06 10:39  叶常落  阅读(63)  评论(0编辑  收藏  举报