Skip to Main Content

SQL & PL/SQL

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 between 2 dates

oraLaroSep 12 2013 — edited Sep 12 2013

I have a check query that I only want to return data for during specific hours of 03:00 to 22:00 hours, lets say for example the check will return 0 or 1, where 1 is an error.    outside of those hours (10pm to 3am)  its possible for it to validly return 1 so I wont want to return an error so Im going to use case against sysdate and if its in those hours I'll return 0.

so something like

select case

        when sysdate between 10pm and 3am

            then 0

       else t1.some_value

   from

     (select some_value from t1)

how to write that when clause?  Do I convert to char and compare or leave it as a date compare

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2013
Added on Sep 12 2013
3 comments
7,628 views