我正在尝试进行首先进行比较的查询 第一个条件是比较 现在和 获取视图的最大年份view_delinquency_allquarter 然后,它将执行第一个查询 否则第二个查询
BEGIN
IF
select max(ctaxyear) as ctaxyear,
(select cast ( (SELECT EXTRACT(QUARTER FROM TIMESTAMP 'now()')) as int ) as yearnow) as yearnow
from view_delinquency_allquarter
where ctaxyear > year_next
THEN
select * from view_delinquency_allquarter;
ELSE
select * from view_delinquency;
END IF;
END