mysql存储过程/函数编写

mysql创建存储过程与函数类似,区别是存储过程没有返回值,函数必须有返回值

资料:
1、
mysql之自定义函数
内容:介绍函数的定义、样例等

测试代码

CREATE DEFINER=`root`@`localhost` FUNCTION `myselect5`(name varchar(15)) RETURNS int
begin 
    declare c int;
    select id from c_nav where fp =name into c;
    return c;
end

函数调用时格式:

select myselect5('123456llll') a;

函数调用不需要再from表单,可以直接返回数据。

2、自定义函数语法
MySQL数据库高级(二)——自定义函数

猜你喜欢

转载自blog.csdn.net/weixin_42377217/article/details/109520011