MySQL多个条件判断示例

 2022-10-27    459  

MySQL多个条件判断是怎样的呢?下面就为您举例说明MySQL多个条件判断,希望对您学习MySQL多个条件判断方面能够有所启迪。

useindustry_finance; 
DELIMITER// 
dropprocedureifexistsupdateCursor// 
CREATEPROCEDUREupdateCursor() 
BEGIN 
declareidvarchar(20); 
declaremonthvarchar(20); 
declareseasonvarchar(20); 
declarecur1CURSORFORSELECTID_,month_FROMt_industry_finance_instance; 
OPENcur1; 
FETCHcur1INTOid,month; 
WHILE(idisnotnull)DO 
if(month='01'||month='02'||month='03')THENsetseason='1'; 
endif; 
if(month='04'||month='05'||month='06')THENsetseason='2'; 
endif; 
if(month='07'||month='08'||month='09')THENsetseason='3'; 
endif; 
if(month='10'||month='11'||month='12')THENsetseason='4'; 
endif; 
updatet_industry_finance_instancesetseasonseason_=seasonwhereID_=id; 
FETCHcur1INTOid,month; 
ENDWHILE; 
CLOSEcur1; 
END;// 
DELIMITER; 
callupdateCursor(); 

MySQL多个条件判断示例

  •  标签:  
  • MySQL
  •  

原文链接:https://77isp.com/post/4299.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。