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!

find times between 5 pm and 7 am (inclusive) from a date time field

360275Aug 31 2011 — edited Aug 31 2011
I'm trying to find all patient appointments scheduled between between 5PM and 7AM. This is for any day. The field appt_date is a date field.

I tried: AND TO_CHAR(APPT_DATE,'HH24:MI:SS AM') >='17:00:00' AND TO_CHAR(APPT_DATE,'HH24:MI:SS') <='07:00:00'
and that leaves out patients with vists at 7AM.
I tried AND TO_CHAR(APPT_DATE,'HH24') between '7' and '17' - knowing it would include too many, but it still does not work.
Any recommendations?

Edited by: br**** on Aug 31, 2011 7:29 AM
This post has been answered by Frank Kulash on Aug 31 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2011
Added on Aug 31 2011
6 comments
2,288 views