SELECT
T_KOJIN_YOTEI."YOTEI" AS "YOTEI",
T_KOJIN_YOTEI."BASHO" AS "BASHO",
T_KOJIN_YOTEI."YOTEI_START_DT" AS "YOTEI_START_DT",
T_KOJIN_YOTEI."YOTEI_END_DT" AS "YOTEI_END_DT",
T_KAIIN."SYSTEM_NM" AS "SYSTEM_NM",
(TO_DATE(TMP.YOTEI_START_DT) + 1) AS TMPYOTEI_START_DT
FROM
T_KOJIN_YOTEI,
T_KAIIN,
(
SELECT
(YOTEI_START_DT - to_Char(T_KOJIN_YOTEI."YOTEI_START_DT", 'D')) as YOTEI_START_DT
FROM
T_KOJIN_YOTEI
WHERE
T_KOJIN_YOTEI.KOJIN_YOTEI_SEQ = ?
) TMP
WHERE
T_KOJIN_YOTEI."YOTEI_START_DT" BETWEEN TO_DATE(TMP.YOTEI_START_DT) + 1 AND TO_DATE(TMP.YOTEI_START_DT) + 7
AND T_KAIIN.USER_CD = T_KOJIN_YOTEI.USER_CD
AND TO_CHAR(T_KOJIN_YOTEI."YOTEI_START_DT", 'HH24:MI:SS') BETWEEN '07:30:00' AND '19:30:00'
AND TO_CHAR(T_KOJIN_YOTEI."YOTEI_END_DT", 'HH24:MI:SS') BETWEEN '07:30:00' AND '19:30:00'
T_KOJIN_YOTEI."YOTEI" AS "YOTEI",
T_KOJIN_YOTEI."BASHO" AS "BASHO",
T_KOJIN_YOTEI."YOTEI_START_DT" AS "YOTEI_START_DT",
T_KOJIN_YOTEI."YOTEI_END_DT" AS "YOTEI_END_DT",
T_KAIIN."SYSTEM_NM" AS "SYSTEM_NM",
(TO_DATE(TMP.YOTEI_START_DT) + 1) AS TMPYOTEI_START_DT
FROM
T_KOJIN_YOTEI,
T_KAIIN,
(
SELECT
(YOTEI_START_DT - to_Char(T_KOJIN_YOTEI."YOTEI_START_DT", 'D')) as YOTEI_START_DT
FROM
T_KOJIN_YOTEI
WHERE
T_KOJIN_YOTEI.KOJIN_YOTEI_SEQ = ?
) TMP
WHERE
T_KOJIN_YOTEI."YOTEI_START_DT" BETWEEN TO_DATE(TMP.YOTEI_START_DT) + 1 AND TO_DATE(TMP.YOTEI_START_DT) + 7
AND T_KAIIN.USER_CD = T_KOJIN_YOTEI.USER_CD
AND TO_CHAR(T_KOJIN_YOTEI."YOTEI_START_DT", 'HH24:MI:SS') BETWEEN '07:30:00' AND '19:30:00'
AND TO_CHAR(T_KOJIN_YOTEI."YOTEI_END_DT", 'HH24:MI:SS') BETWEEN '07:30:00' AND '19:30:00'