Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Date Compare

Re: Date Compare

From: Michael Dodd <doddme_at_mindspring.com>
Date: Wed, 14 Mar 2001 22:10:09 -0600
Message-ID: <e5e0bt8uuhd9o1ose7g297je0ob7sndscv@4ax.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US