MySQL 流程控制return語句


• Return語句用在函數中,用來終結函數的執行並將指定值返回給調用者
• 在函數中必須要有至少一個return語句,當有多個return語句時則表明函數有多種退出的方式

delimiter //
create function doreturn()
returns int
begin
select sex into @a from students where sid=1;
if @a=1 then return 1;
elseif @a=0 then return 0;
else return 999;
end if;
end;
//
delimiter ;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM