您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

MySQL 有输入输出参数的存储过程实例

2025/6/1 20:27:18发布17次查看
mysql 有输入输出参数的存储过程实例
1、实例
代码如下:
delimiter //
drop procedure if exists `test`.`p_getvalue` //
create definer=`root`@`localhost` procedure `p_getvalue`(
in id varchar(20),out s varchar(20)
)
begin
if (length(id)=11) then select 'a_b_c_d' into s;
elseif(length(id)=8) then select 'a_b_c' into s;
elseif(length(id)=5) then select 'a_b' into s;
elseif(length(id)=2) then select 'a' into s;
end if;
select s;
end //
delimiter ;
2、调用
代码如下:
call p_getvalue('11000112',@s)
3、结果
'a_b_c'
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product