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: PL/SQL: defining default value for table type

Re: PL/SQL: defining default value for table type

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Sun, 17 Jul 2005 07:37:44 -0400
Message-ID: <FsidnfL9nNOW3kffRVn-qw@comcast.com>

"Matthias Wirtz" <Matthias.Wirtz_at_gmx.net> wrote in message 
news:6drCe.56269$iU.22205_at_lakeread05...

> "IANAL_VISTA" <IANAL_Vista_at_hotmail.com> wrote in
> news:Xns9695B70D15C85SunnySD_at_68.6.19.6...

...

>> I'm not clear on why you think you can or should use "DEFAULT" as you
>> want
>> to do.
>
> I want to be able to ommit the parameter when calling the procedure
> 'p2.result'. Be specifying a DEFAULT value for the parameter of the
> procedure it is not neccessary to pass a value while calling.
>
> I didn't state this in my first posting but I should have to make thinks
> more clearly.
> --
> Matthias Wirtz - Norfolk, USA
>
>

use the same technique in the procedure that you arleady got working in the 2nd package:

SQL> CREATE OR REPLACE PACKAGE p1 IS
  2 TYPE t_array IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;   3 END;
  4 /

Package created.

SQL> CREATE OR REPLACE PACKAGE p2 IS
  2 empty_array p1.t_array;
  3 PROCEDURE result(array p1.t_array DEFAULT empty_array);   4 END;
  5 /

Package created.

SQL> CREATE OR REPLACE PROCEDURE proc1
  2 (
  3 array p1.t_array DEFAULT p2.empty_array -- p1 type reference, p2 variable as default
  4 )
  5 AS
  6 BEGIN
  7 NULL;
  8 END;
  9 /

Procedure created.

or, better yet, just declare the empty_array variable in p1 so everything is in the same place (ease of maintenance, reduces object dependencies)

++ mcs Received on Sun Jul 17 2005 - 06:37:44 CDT

Original text of this message

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