Re: Calling a procedure with an interval literal

From: De DBA <dedba_at_tpg.com.au>
Date: Thu, 30 Aug 2012 22:06:12 +1000
Message-ID: <503F5734.9080504_at_tpg.com.au>



Thanks, that worked :)

<rant>A bit kludgey it remains though - the precision appears to be an attribute of the type, unlike precision and scale of a number, but it can't be declared as a type declaration with the formal parameter. One would think that it being a built-in type it could be used in any situation without the need of redefining it first.. what use is a "default" value if an actual value cannot be passed? And with a 365-day year, why a 99 day default in the 1st place.. </rant>

..I'll go back to my corner now.. ;)

Cheers,
Tony

On 30/08/12 14:52, Daniel Westermann wrote:
> Hi Tony,
>
> that's because of the default precision of 2. You may use a package and a subtype for this:
>
> create or replace package ptest
> is
> subtype my_interval is interval day(3) to second;
> procedure p1 ( v_interval IN my_interval );
> end;
> /
> create or replace package body ptest
> is
> procedure p1 ( v_interval IN my_interval )
> is
> begin
> null;
> end p1;
> end;
> /
> SQL> exec ptest.p1 ( interval '230 23:0:0.1' day to second );
> PL/SQL procedure successfully completed.
> SQL> exec ptest.p1 ( interval '23 23:0:0.1' day to second );
> PL/SQL procedure successfully completed.
> SQL>
>
> Cheers, Daniel
>
><cut due to overquoting>

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Aug 30 2012 - 07:06:12 CDT

Original text of this message