mysql存儲過程-匯總學習
阿新 • • 發佈:2017-06-12
存儲 ont 數量 div 正常 where bold name 簡單的
簡單的存儲過程插入語句
BEGIN INSERT into useraccount VALUES (10,10,3,‘2013-01-02‘,9);#RoauDtine body goes here... select ROW_COUNT(); -- 表示影響的行數 END
簡單的存儲過程ifelse語句(UserId為in,UserName為out)
BEGIN IF UserId = 18 THEN SET UserName = ‘5‘; END IF; IF UserId = 14 THEN SETUserName = ‘4‘; END IF; #Routine body goes here..., END
簡單的存儲過程ifelse語句(UserId為in,UserName為out),這裏遇到的問題是select 返回數量和正常查詢的結果不一致,後來改了多個參數,最終確定為userid與表中UserId重復導致,而且大小寫也無法區分,所以將其更改為userid1
BEGIN if(username>5) THEN select count(*) from useraccount where UserId>17;#Routine body goes here...ELSE SET userid1=4; end if ; END
mysql存儲過程-匯總學習