SELECT *
FROM tippertable
WHERE TRUNC (DT) >=
TO_DATE(:decalyear, 'mm/yyyy')
and TRUNC (DT) <
add_months(TO_DATE(:decalyear, 'mm/yyyy'), 1)
and acc_missed IS NOT NULL
ORDER BY DT
I have a drop-down list of month and year called (decal year) in it I have: April 2016,March 2016 down all the way to April 2015.when let say March 2016 is selected and run it gives me all the month of March .
Next If i run the below sql statement for the fiscal year(July 01- june 30) i will get my dates from 7/1/2015 -4/28/2016.
SELECT *
FROM tippertable
WHERE TRUNC (DT) >=(CASE
WHEN TO_NUMBER (TO_CHAR (SYSDATE, 'MM')) > 6
THEN
ADD_MONTHS (TRUNC (SYSDATE, 'YYYY'),1)
ELSE
ADD_MONTHS (TRUNC (SYSDATE, 'YYYY'),(TO_NUMBER (TO_CHAR (SYSDATE, 'MM')) -10))
END)
and acc_missed IS NOT NULL
ORDER BY DT
Now my question is how can i insert the decalyear: prompt to run my fiscal year sql statement when a month and year is selected from the drop-down. Thanks very much John