欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

[MySQL]存储过程(store procedure)相关

程序员文章站 2022-04-23 08:36:27
...

1.变量:

set @var=xx; //全局

select @var:= xxxx; //在select语句中要用:=来赋值

declare xx; //限于存储过程内

 

打印变量select @var;

引用变量test_process(@var);   //不要忘记了@

 

2.存储过程:

In 和 out的值都放在括号内,例如test_process(@in,@out);

 

3.例子:

#set @pSubmitTimeFr=sysdate();
set @pSubmitTimeFr='2019-02-16 10:21';
#set @pSubmitTimeFr=str_to_date('2019-02-16 10:21','%Y-%m-%d %H:%i'); //两种写法都可以
select @pSubmitTimeFr;
set @pSubmitTimeTo=sysdate()+1;
set @pCorpID=1;
set @pSenderList=85297887827;
set @pRecipientList=85297887888;
set @pChannel='sms';
set @pDirection='corp to mobile user';
set @pMsgStatusList='DELIVRD';
set @pMsgContent='SMS testing - good morning';
set @outRtnCode=null;
set @outErrMsg=null;
call umg.SP_UNIFIED_PORTAL_SEARCH_MSG_CSV(@pSubmitTimeFr,@pSubmitTimeTo,@pCorpID,@pSenderList,@pRecipientList,@pChannel,@pDirection,@pMsgStatusList,@pMsgContent,@outRtnCode,@outErrMsg);
select @outRtnCode;
select @outErrMsg;

 

相关标签: 存储过程