[SQL]不用day picker挑選日期的方法

create view with parameter pick date without day picker

需求建立逐日的Lov,可以應用在Form或者Report的parameter使用Value Set

其中使用P_date這點也蠻特別的,我也是第一次使用

CREATE OR REPLACE FORCE VIEW apps.lu_day_lov
(
    "P_DATE"
) AS
    SELECT TO_DATE(p_date, 'DD-MON-RRRR') p_date
    FROM ((SELECT TO_DATE(SYSDATE - 1 + LEVEL, 'DD-MON-RRRR') p_date
           FROM DUAL
           CONNECT BY LEVEL <= 8
           UNION
           SELECT TO_DATE(SYSDATE + 1 - LEVEL, 'DD-MON-RRRR') p_date
           FROM DUAL
           CONNECT BY LEVEL <= 365))
    ORDER BY p_date DESC;