Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Date Compare
Assuming that initdatehour and finaldatehour are date types in the table table_prod and you want to to see if NOW is between those two dates.
select primarykey from table_prod where initdatehour <= sysdate and finaldatehour >= sysdate;
check your syntax on the cursor:
cursor c_curdate is select .....
If it fails you're going to have nothing in your cursor, that's all. Maybe I'm missing something here, but there's nothing wrong with comparing dates.
I really don't see what's hanging people up with this...
On Wed, 14 Mar 2001 15:36:51 -0400, <gmelo_at_bbr.cl> wrote:
>Hi:
>
>
>There is a way to compare 2 dates, like this (for a cursor) :
>
>Declare Cursor cur_date
>Select PrimaryKey
>From Table_Prod
>Where InitiatDate&Hour <= sysdate And
> FinalDate&Hour >= sysdate;
>
>????
>
>I know the to_date and substr function, but doesn't work...
>
>other way :
>Where InitialDate&Hour - sysdate <= 0 And
> FinalDate&Hour - sysdate >=0
>
>The answer isn't easy, many people is hang up with this...
>
>Thanks
>
Received on Wed Mar 14 2001 - 22:10:09 CST
![]() |
![]() |