Skip to Main Content

query -- fetch data with specific date in 24 hrs

User_IAP38Sep 15 2022

Hello,
I just need three rows from the table since I need the data for a specific date from 20:00 to 08:00.
I tried using a timestamp, but it failed. can you help me
start1 is varchar column ,
with sqltmp as (
select 1 id, sysdate date1, '20:00' start1 from dual union all
select 2 id, sysdate date1, '24:00' start1 from dual union all
select 1 id, sysdate date1, '08:00' start1 from dual union all
select 1 id, sysdate-1 date1, '20:00' start1 from dual )
select * from sqltmp where date1=sysdate and to_timestamp(start1,'HH24:MI')>=to_timestamp('20:00','HH24:MI');

error: ORA-01850: hour must be between 0 and 23

This post has been answered by BluShadow Mr on Sep 15 2022
Jump to Answer
Comments
Post Details
Added on Sep 15 2022
9 comments
62 views