language sql
specific F_GETDATE_BY_Q
returns varchar(8)
begin atomic
declare v_result varchar(8);
declare v_current_date varchar(8);
declare v_date_of_quarter_end varchar(8);
declare v_date_of_quarter_begin varchar(8);
set v_current_date = (select to_char(current date,'YYYYMMDD') from sysibm.sysdummy1);
set v_date_of_quarter_end = (select max(biz_date) from f_com_com_date where year = year(current date) and q = p_quarter);
set v_date_of_quarter_begin = (select min(biz_date) from f_com_com_date where year = year(current date) and q = p_quarter);
if (v_current_date < v_date_of_quarter_begin) then
set v_result = '19000230';
else if (v_current_date >= v_date_of_quarter_begin and v_current_date <= v_date_of_quarter_end) then
set v_result = v_current_date;
else if (v_current_date > v_date_of_quarter_end) then
set v_result = v_date_of_quarter_end;
end if;
return v_result;
end
>[错误] 脚本行:24-24 -------------------------------------
An unexpected token "END-OF-STATEMENT" was found following "end". Expected tokens may include: "JOIN
麻烦大家给看下是哪儿出错了,先谢了