1、实例文章源自很文博客https://www.hinwi.com/很文博客-https://www.hinwi.com/50760.html
- 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、调用文章源自很文博客https://www.hinwi.com/很文博客-https://www.hinwi.com/50760.html
- CALL p_getvalue('11000112',@S)
3、结果文章源自很文博客https://www.hinwi.com/很文博客-https://www.hinwi.com/50760.html
'A_B_C'文章源自很文博客https://www.hinwi.com/很文博客-https://www.hinwi.com/50760.html 文章源自很文博客https://www.hinwi.com/很文博客-https://www.hinwi.com/50760.html
我的微信
扫一扫更精彩
大家的支持是我更新的动力!!!
评论