Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Passing Tables
Hi.
You must create a package and declare your TYPE in package spec. From that moment on you may pass variables of that type to/from any function/procedure.
CREATE OR REPLACE PACKAGE example_pck IS type StrSanRec IS RECORD (
v_adm_cost SMALLINT := 0, v_off_amt1 SMALLINT := 0, v_off_mis1 SMALLINT := 0, v_off_amt2 SMALLINT := 0, v_off_mis2 SMALLINT := 0, v_off_amt3 SMALLINT := 0, v_off_mis4 SMALLINT := 0);
FUNCTION example_fnc ( p_tab IN StrSanTabType ) RETURN StrSanTabType;
END example_pck;
... Define package body ...
In PL/SQL you use:
DECLARE
my_tab1 example_pck.StrSanTabType;
my_tab2 example_pck.StrSanTabType;
i NUMBER;
BEGIN
my_tab2 := example_pck.example_fnc ( my_tab1 );
END;
HTH. Michael.
In article <823s2r$ps4$1_at_nnrp1.deja.com>,
amerar_at_ci.chi.il.us wrote:
>
>
> Hello,
>
> I'm not sure of the syntax of the statement I am trying to write. I
> have a table definition like this:
>
> type StrSanRec IS RECORD (
> v_adm_cost SMALLINT := 0,
> v_off_amt1 SMALLINT := 0,
> v_off_mis1 SMALLINT := 0,
> v_off_amt2 SMALLINT := 0,
> v_off_mis2 SMALLINT := 0,
> v_off_amt3 SMALLINT := 0,
> v_off_mis4 SMALLINT := 0);
> type StrSanTab IS TABLE OF StrSanRec index by binary_integer;
> v_strsan_data StrSanTab;
>
> I will have a max of 7 rows in this table.
>
> I need to write a Function that I will be calling 7 times during the
> execution of the procedure. Each time through this Function I will
need
> to modify a different row of the table, and possibly all the elements
in
> that row.
>
> How can I pass the entire table or row to the Function, and then
return
> it properly? Can I pass an entire table?
>
> Thanks,
>
> Arthur
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Wed Dec 01 1999 - 14:37:53 CST