推荐码无效

2019-06-13  本文已影响0人  F的平方

SET GLOBAL event_scheduler = on;

delimiter //

drop procedure if exists validity_code//

create procedure validity_code()

begin

update BO_EU_SUPPLIER_RECOMMEND set RECOMMEND_CODE_STATE=4 where RECOMMEND_CODE_STATE=2 and RECOMMEND_CODE_EXPIRE<now();

end

//

delimiter ;

drop event if exists validity_event;

create event validity_event

on schedule every 1 second

on completion preserve disable

do call validity_code();

alter event validity_eventon completion preserve enable;



select IF(t1.valid=0,'无有效培训证书','3') as youxiao from (select t.valid from ( select count(*) AS valid from BO_EU_CA ) t) t1;

select IF((select IF(count(CA_NO)=0,0,1) from BO_EU_CA where CA_SUPPLIER_ID='@departmentId')=0,0,(select CA_NO from BO_EU_CA where CA_SUPPLIER_ID ='@departmentId')) as CANO;

@sqlValue(select IF((select IF(count(CA_NO)=0,0,1) from BO_EU_CA where CA_SUPPLIER_ID='@departmentId')=0,'没有相关有效培训证书',(select CA_NO from BO_EU_CA where CA_SUPPLIER_ID ='@departmentId')) as CANO)


select IF((select CA_NO from BO_EU_CA where CA_SUPPLIER_ID ='@departmentId'),(select CA_NO from BO_EU_CA where CA_SUPPLIER_ID ='@departmentId'),0) as CA_NO;

上一篇 下一篇

猜你喜欢

热点阅读