Re: PL/SQL Intervals are dizzy

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Thu, 26 Aug 2004 09:30:18 +0200
Message-ID: <cgk35q$vik$1_at_news3.tilbu1.nb.home.nl>


Danes wrote:

> Maybe I am just dizzy but I thought that 600 seconds is 10 minutes...
> Obviously not! Or maybe PL/SQL is just dizzy.
>
> SQL> declare
> 2 blah1 interval day to second := interval '600' second;
> 3 blah2 interval day to second := interval '10' minute;
> 4 begin
> 5 if blah1 <> blah2 then
> 6 dbms_output.put_line('plsql is shit');
> 7 else
> 8 dbms_output.put_line('maybe not');
> 9 end if;
> 10 end;
> 11 /
> plsql is shit
>
> PL/SQL procedure successfully completed.
>
> SQL> declare
> 2 blah1 interval day to second := interval '601' second;
> 3 blah2 interval day to second := interval '10' minute;
> 4 begin
> 5 if blah1 < blah2 then
> 6 dbms_output.put_line('plsql is really shit');
> 7 else
> 8 dbms_output.put_line('maybe not');
> 9 end if;
> 10 end;
> 11 /
> plsql is really shit
>
> PL/SQL procedure successfully completed.
>
> SQL>
If I understand correctly, you must do the math yourself (from the SQL Reference, on Interval):

The valid range of values for the trailing field are as follows:

HOUR: 0 to 23
MINUTE: 0 to 59
SECOND: 0 to 59.999999999

Although I get it to work with less than 100 seconds as well... Just print blah1 (it's 0 when greater than 99 specified)

Also, I tested with 9.2.0.4, which seem to have some bugs (many examples did not work...) in this area

-- 

Regards,
Frank van Bortel
Received on Thu Aug 26 2004 - 09:30:18 CEST

Original text of this message