该查询应返回当前会计月份的天数。检查以下查询:
SELECT *
FROM GL_PERIODS
WHERE PERIOD_SET_NAME='Fiscal Year'
AND period_year =(SELECT DISTINCT period_year
FROM gl_periods
WHERE TRUNC (SYSDATE) BETWEEN start_date
AND end_date)
对于期间名称:SEP-19,Start_Date 是 8/26/2018。因此,sysdate 的天数应该是 16。
样本数据:
period_set_name period_name start_date end_date entered_period_name
Fiscal Year AUG-19 7/29/2018 8/25/2018 AUG
Fiscal Year SEP-19 8/26/2018 9/22/2018 SEP
Fiscal Year OCT-19 9/23/2018 10/27/2018 OCT
预期产出:16