当前位置:
MySQL多个条件判断示例
时间:2025-11-04 17:19:23 出处:IT科技阅读(143)

复制use industry_finance; DELIMITER // drop procedure if exists updateCursor // CREATE PROCEDURE updateCursor() BEGIN declare id varchar(20); declare month varchar(20); declare season varchar(20); declare cur1 CURSOR FOR SELECT ID_,多断示month_ FROM t_industry_finance_instance; OPEN cur1; FETCH cur1 INTO id,month; WHILE (id is not null ) DO if(month=01||month=02||month=03) THEN set season=1; end if; if(month=04||month=05||month=06) THEN set season=2; end if; if(month=07||month=08||month=09) THEN set season=3; end if; if(month=10||month=11||month=12) THEN set season=4; end if; update t_industry_finance_instance set seasonseason_=season where ID_=id; FETCH cur1 INTO id,month; END WHILE; CLOSE cur1; END;// DELIMITER ; call updateCursor(); 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.
                分享到:
                
温馨提示:以上内容和图片整理于网络,仅供参考,希望对您有帮助!如有侵权行为请联系删除!