MySQL 有输入输出参数的存储过程实例
时间:2024-01-24 23:00:01
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'
标签:MySQL,输入输出,存储过程
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
javascript实现计算器功能详解流程
2024-04-23 09:27:00
![](https://img.aspxhome.com/file/2023/5/135525_0s.png)
Golang空结构体struct{}用途,你知道吗
2024-04-26 17:36:56
ADO.NET 连接数据库字符串小结(Oracle、SqlServer、Access、ODBC)
2024-01-22 07:43:47
Django框架中表单的用法
2022-03-29 02:00:14
![](https://img.aspxhome.com/file/2023/0/103110_0s.gif)
浅谈python输出列表元素的所有排列形式
2023-02-10 11:09:39
mysql5.7 设置远程访问的实现
2024-01-20 12:40:57
![](https://img.aspxhome.com/file/2023/3/110333_0s.png)
SQL2005查询表结构的SQL语句使用分享
2024-01-15 21:47:52
Python利用Beautiful Soup模块创建对象详解
2023-05-17 23:24:58
CNN卷积函数Conv2D()各参数的含义及用法解读
2022-03-12 05:35:21
![](https://img.aspxhome.com/file/2023/4/76954_0s.png)
pycharm激活方法到2099年(激活流程)
2022-11-17 05:45:35
![](https://img.aspxhome.com/file/2023/5/90675_0s.png)
MySQL的存储过程写法和Cursor的使用
2008-12-03 15:55:00
程序员用vscode听网易云的实现
2022-12-20 06:31:55
![](https://img.aspxhome.com/file/2023/4/135184_0s.jpg)
python实现beta分布概率密度函数的方法
2021-08-02 21:39:16
![](https://img.aspxhome.com/file/2023/9/93449_0s.jpg)
JavaScript html5 canvas实现图片上画超链接
2024-04-28 10:19:19
手把手教你Python yLab的绘制折线图的画法
2023-03-11 21:21:43
![](https://img.aspxhome.com/file/2023/7/112587_0s.png)
手把手教你使用Python解决简单的zip文件解压密码
2021-01-20 10:08:41
![](https://img.aspxhome.com/file/2023/4/117894_0s.jpg)
在Vue项目中使用Typescript的实现
2024-04-26 17:39:57
![](https://img.aspxhome.com/file/2023/7/133137_0s.png)
数字人组件反写[asp组件开发实例5]
2009-06-09 13:23:00
![](https://img.aspxhome.com/file/UploadPic/20093/9/20093918286639s.gif)
利用Python操作excel表格的完美指南
2022-05-21 07:59:09
![](https://img.aspxhome.com/file/2023/2/120972_0s.png)
09七夕节各大搜索引擎LOGO欣赏
2009-08-27 15:34:00
![](https://img.aspxhome.com/file/UploadPic/20098/27/09-tanabata-festival-search-logo-44s.jpg)