Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Returning an array from a procedure/ function
Simon Davies wrote:
> I'm struggling to work out how to return an array(table) from a pl/sql
> function/procedure. I have tried various methods using both functions
> and procedures.
>
> I currently have the following code:
>
> * Package *
>
> CREATE OR REPLACE PACKAGE MyPackage as
> TYPE ARRAY IS TABLE OF VARCHAR2(250);
> PROCEDURE MyProcedure(MyArray IN OUT ARRAY);
> END;
> /
>
> CREATE OR REPLACE PACKAGE BODY MyPackage IS
> PROCEDURE MyProcedure(MyArray IN OUT ARRAY) is
> BEGIN
> <snipped>
> END;
> END;
> /
>
> * Procedure Call *
> DECLARE
> TYPE ARRAY IS TABLE OF VARCHAR2(250);
> MyArray ARRAY := LOGIN_AREA('','','','','','','','','','','','','','','');
> BEGIN
> MySchema.MyPackage.MyProcedure(MyArray);
> END;
>
> ***
>
> Do excuse the poor quality of the above code. I haven't been doing
> this very long. All suggestion and critism greatly recieved.
>
> Cheers Simon
Visit http://asktom.oracle.com.
But why mess around with an array? Why not return a REF CURSOR?
-- Daniel Morgan http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Fri Jul 04 2003 - 11:17:30 CDT
![]() |
![]() |