Mysql帶返回值與不帶返回值的2種存儲過程寫法
更新時間:2017年10月07日 10:16:01 投稿:mrr
這篇文章主要介紹了Mysql帶返回值與不帶返回值的2種存儲過程寫法,需要的朋友可以參考下
過程1:帶返回值:
drop procedure if exists proc_addNum; create procedure proc_addNum (in x int,in y int,out sum int) BEGIN SET sum= x + y; end
然后,執(zhí)行過程,out輸出返回值:
call proc_addNum(2,3,@sum); select @sum;
過程2:不帶返回值:
drop procedure if exists proc_addNum; create procedure proc_addNum (in x int,in y int) BEGIN DECLARE sum int; SET sum= x + y; SELECT sum; end
執(zhí)行過程:
call proc_addNum(2,3);
總結(jié)
以上所述是小編給大家介紹的Mysql帶返回值與不帶返回值的2種存儲過程寫法,希望對大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會及時回復(fù)大家的!
相關(guān)文章
PhpMyAdmin 配置文件現(xiàn)在需要一個短語密碼的解決方法
本文主要介紹PhpMyAdmin 配置文件現(xiàn)在需要一個短語密碼的解決方法,比較實用,希望能給大家做一個參考。2016-06-06解決mysql報錯:1264-Out of range value for&nb
這篇文章主要介紹了解決mysql報錯:1264-Out of range value for column ‘字段‘ at row 1問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-11-11