exists

SELECT TO_CHAR(ADD_MONTHS(SYSDATE, -2), 'YYYYMM') MON
  FROM DUAL
WHERE EXISTS (SELECT 1 FROM DUAL WHERE TO_CHAR(SYSDATE, 'DD') < '09')
UNION
SELECT TO_CHAR(ADD_MONTHS(SYSDATE, -1), 'YYYYMM') MON
  FROM DUAL
WHERE EXISTS (SELECT 1 FROM DUAL WHERE TO_CHAR(SYSDATE, 'DD') > '08')

你可能感兴趣的:(exists)