Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Case statement with Greater then sign

2796536Dec 15 2014 — edited Dec 16 2014

Hi All,

I am trying to build the query, but not getting the exact result,

Below the query.

select

(case when SDS_WITH_EXPOSURE_SCENARIO_ES='N' and (sysdate - SITE_RECEIVED_DATE) >270 then (sysdate - SITE_RECEIVED_DATE)

           when SDS_WITH_EXPOSURE_SCENARIO_ES='Y' and (sysdate - SITE_RECEIVED_DATE) >360 then (sysdate - SITE_RECEIVED_DATE)

else (sysdate - SITE_RECEIVED_DATE)

end) as "Days in Progress"

FROM

PSRDM_COMPL_VIEW

So based on the user input, if the SDS_WITH_EXPOSURE_SCENARIO_ES is “N”, then (sysdate - SITE_RECEIVED_DATE) > 270 should be displayed and if SDS_WITH_EXPOSURE_SCENARIO_ES is “Y” then (sysdate - SITE_RECEIVED_DATE) > 360 should be displayed.

But When I am setting it to “Y” or “N”, I am not getting the correct result

For “Y”, I am getting (So I am also getting values less than 360)

Days in Progress

734.308726851851851851851851851851851852

308.308726851851851851851851851851851852

279.308726851851851851851851851851851852

1465.308726851851851851851851851851851852

399.308726851851851851851851851851851852

2836.308726851851851851851851851851851852

For “N”, I am getting, (So I am getting values less than 270 also)

Days in Progress

369.303726851851851851851851851851851852

307.303726851851851851851851851851851852

126.303726851851851851851851851851851852

187.303726851851851851851851851851851852

279.303726851851851851851851851851851852

65.30372685185185185185185185185185185185

369.303726851851851851851851851851851852

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2015
Added on Dec 15 2014
3 comments
1,775 views