mysql方法:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `Fir_Work_Day`(interval_day nvarchar(10)) RETURNS int(11)
BEGIN
/*DECLARE day_temp INTEGER;
DECLARE month_temp INTEGER;*/
DECLARE date_flag date;
select min(`date`) into date_flag
from dim_date
where y = year(now())
and m = month(now())
and Holiday_flag in(0,2);
if CURDATE() <= ADDDATE(date_flag, INTERVAL interval_day day)
then return 0; # month need -1
ELSE return 1; # month not need change
end if;
END$$
DELIMITER ;
MySQL存储过程:
ps:返回多行查询,不需要设置out参数,只需要执行select 多行的语句即可
delimiter $$
create procedure permision(in p_fine_userName varchar(20), in permision_flag int, in visit_userName varchar(20), in view_cpt varchar(100), in temp5 varchar(100), in temp6 varchar(100),in temp7 varchar(100),in temp8 varchar(100), out permisions varchar(100))
begin
if permision_flag = 0
then
select '上海G4.5' as org
union all
select '厦门G5.5' as org into permisions;
else
select 'A-si基地群' as org
union all
select 'LTPS基地群' as org into permisions;
end if;
end$$;