Re: Calling a procedure with an interval literal

  • From: De DBA <dedba@xxxxxxxxxx>
  • To: Oracle Discussion List <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 30 Aug 2012 22:06:12 +1000

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>
--
//www.freelists.org/webpage/oracle-l


Other related posts: