The query should return the day number of the current fiscal month.Check the below query:
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)
For period name : SEP-19, Start_Date is 8/26/2018. So, day number should be 16 for sysdate.
Sample Data:
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
Expected Output: 16