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

很文博客hinven.com 数据库评论342字数 447阅读模式
广告也精彩

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

1、实例文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50760.html

  1. DELIMITER // 
  2. DROP PROCEDURE IF EXISTS `test`.`p_getvalue` // 
  3. CREATE DEFINER=`root`@`localhost` PROCEDURE `p_getvalue`(
  4. in id varchar(20),out s varchar(20)
  5. )
  6. begin
  7. if (length(id)=11) then select 'A_B_C_D' into s;
  8. elseif(length(id)=8) then select 'A_B_C' into s;
  9. elseif(length(id)=5) then select 'A_B' into s;
  10. elseif(length(id)=2) then select 'A' into s;
  11. end if;
  12. select s;
  13. end // 
  14. DELIMITER ;

2、调用文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50760.html

  1. CALL p_getvalue('11000112',@S)

3、结果文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50760.html

'A_B_C'文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50760.html 文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50760.html

工具:作品在线观看

女优:最新作品观看

中文:国语在线观看

weinxin
我的微信
扫一扫更精彩
大家的支持是我更新的动力!!!
 
广告也精彩
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证