|
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'
(编辑:安卓应用网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|