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

Home -> Community -> Usenet -> c.d.o.misc -> Re: plsql date comparison

Re: plsql date comparison

From: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Tue, 06 Aug 2002 03:01:04 GMT
Message-ID: <QZG39.3796$7n5.2177@sccrnsc01>


dates aren't strings like apples aren't oranges. I would convert your string to a date and then compare the resulting dates. See the to_date function in the SQL reference guide.
Jim
"Mark" <mark.hamlin_at_artdigital.co.uk> wrote in message news:aim8pb$jm8$1_at_pheidippides.axion.bt.co.uk...
> I am having "fun" with date comparison with plsql. I need to test to see
if
> log_date is earlier or later sess_cut. I think I've learnt that earlier
is
> different to less!!
>
> if (log_date > sess_cut ) then
> devlog (aas||'PASS: (log_str '|| log_str || ') later (sess_cut: '||
> sess_cut_str || ' )' );
> elsif (log_date < sess_cut ) then
> devlog (aas||'FAIL: (log_str '|| log_str || ') earlier (sess_cut: '||
> sess_cut_str || ' )' );
> end if;
>
> I get unpredictable results from this:
> *GOOD*
> PASS: (log_str 05-08-02 05:11:08) later (sess_cut: 05-08-02 04:56:08 )
> *BAD*
> FAIL: (log_str 05-08-02 04:52:47) earlier (sess_cut: 05-08-02 04:49:10 )
>
> If I simply reverse my logic I still get unpredictable results. I'm
having
> trouble converting these dates into the numeric value. I tried << myfloat
:=
> mydate; >> which compiled but gave me a runtime conversion error.
>
> Mark
>
>
Received on Mon Aug 05 2002 - 22:01:04 CDT

Original text of this message

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