Hi,
I am unable to work out the below code. I am trying to prompt the user with a list of date values and passing them to decode and if user selects ‘’ and passing '=’*’ in the where clause of the oracle so that it would retrieve all the records. But its throwing ORA-00907; missing right parenthesis error. Can someone please help and suggest alternative solution ?
(case when decode(@Prompt(‘Select timeframe for which to run the report:’, ‘A’, {‘Current Month’, ‘Last Month’,’’}, MONO, CONSTRAINED,persistent,{’’},User:0)
, ‘’, '’
, ‘Current Month’, to_char((select sysdate from sys.dual@catsprd), ‘YYYYMM’) || ‘01’
, ‘Last Month’, to_char(add_months((select sysdate from sys.dual@catsprd), -1), ‘YYYYMM’) || ‘01’
) = '*'
then '''*''=''*'''
else
(
to_char(INCIDENT_DETAILS.INCIDENT_DATE, ‘yyyymmdd’) >= decode(@Prompt(‘Select timeframe for which to run the report:’, ‘A’, {‘Current Month’, ‘Last Month’,’’}, MONO, CONSTRAINED,persistent,{’’},User:0)
, ‘’, '’
, ‘Current Month’, to_char((select sysdate from sys.dual@catsprd), ‘YYYYMM’) || ‘01’
, ‘Last Month’, to_char(add_months((select sysdate from sys.dual@catsprd), -1), ‘YYYYMM’) || ‘01’
)
AND
to_char(INCIDENT_DETAILS.INCIDENT_DATE, ‘yyyymmdd’) < decode(@Prompt(‘Select timeframe for which to run the report:’, ‘A’, {‘ALL’,‘Current Month’, ‘Last Month’, ‘’}, MONO, CONSTRAINED,persistent,{’’})
, ‘’, '’
, ‘Current Month’, to_char(add_months((select sysdate from sys.dual@catsprd), 1), ‘YYYYMM’) || 01
, ‘Last Month’, to_char((select sysdate from sys.dual@catsprd), ‘YYYYMM’) || ‘01’
)
)
end
)
vahmedk (BOB member since 2014-10-24)