Hi,
The code below is working for all records but its not working for "Last month" and "Current month" values. If I select "Last month" when running the report query, its not showing last month records instead showing all the records. Can you please advise?
to_char(fffdate, 'yyyymmdd') >= decode(@Prompt('Select time for which to run the report(or * for all):', 'A', {'Current Month', 'Last Month','*'}, MONO, CONSTRAINED,persistent,{'*'},User:0)
, '*', '*'
, 'Current Month', to_char((select sysdate from sys.dual), 'YYYYMM') || '01'
, 'Last Month', to_char(add_months((select sysdate from sys.dual), -1), 'YYYYMM') || '01'
)
AND
to_char(fffdate, 'yyyymmdd') < decode(@Prompt('Select time for which to run the report(or * for all):', 'A', {'ALL','Current Month', 'Last Month','*'}, MONO, CONSTRAINED,persistent,{'*'})
, '*', '*'
, 'Current Month', to_char(add_months((select sysdate from sys.dual), 1), 'YYYYMM') || 01
, 'Last Month', to_char((select sysdate from sys.dual), 'YYYYMM') || '01'
) '*' = '*'
Thanks.