Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL: defining default value for table type
"Matthias Wirtz" <Matthias.Wirtz_at_gmx.net> wrote in message news:6drCe.56269$iU.22205_at_lakeread05...
...
>> 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