SELECT *
FROM
(SELECT
PER_CUR.DATEASSTRINGFORCLASS(PER_DATE_FROM,'GB') AS PERDATE,
PER_NO,
rangeutil.f_setpcdrangeperiod('M', PER_CUR.DATEASSTRINGFORCLASS(PER_DATE_FROM, 'GB')) AS PERIOD
FROM
PER_W
WHERE
PERT_CODE = 'YM2'
AND PER_NO >= RANGEUTIL.ADDNUMPERIOD('YM2', RANGEUTIL.DATEPERIOD('YM2'), -4)
AND per_date_from < '02-JUN-21'
UNION
SELECT
PER_CUR.DATEASSTRINGFORCLASS(PER_DATE_FROM,'GB') AS PERDATE, PER_NO,
rangeutil.f_setpcdrangeperiod('M', PER_CUR.DATEASSTRINGFORCLASS(PER_DATE_FROM,'GB')) AS PERIOD
FROM
PER_W
WHERE
PERT_CODE = 'YM'
AND per_date_from > '01-JUN-21'
AND PER_NO >= RANGEUTIL.ADDNUMPERIOD('YM', RANGEUTIL.DATEPERIOD('YM'), -4))
WHERE
per_no >= rangeutil.f_defaultPcdRangePeriod('M')
ORDER BY
2;
question from:
https://stackoverflow.com/questions/65847898/is-there-any-alter-way-to-increase-the-execution-speed-currently-the-below-quer 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…