I have a stored procedure where I am populating a table from an array of records (Fees) and then putting those rows into a ref cursor.
TYPE rctl IS REF CURSOR ;
Fees t_Fees;
type t_Fees is table of t_FeeRecord index by binary_integer;
type t_FeeRecord is record(
description varchar2(80),
amount number(12,2),
taxAmount number(12,2)
);
--populate the Fees array
INSERT into TEMPORARY_FEE(description,amount,tax) values(Fees(i).description,Fees(i).Amount,Fees(i).Tax);
OPEN rc1 FOR SELECT description,amount TEMPORARY_FEES;
This all works fine (populating the record, inserting into temp table and populating the ref cursor) but is it possible to eliminate the table and just pass my array of records directly into the ref_cursor? I have to return the results as a ref_cursor for a third party application.
I thought I might be able to try something like this.
OPEN rc1 FOR
SELECT * FROM TABLE(cast(Fees as t_FeeRecord));
but I get an invalid datatype.
table()doesn't operate on record types. Ift_feeswas declared withcreate typeat SQL level then you could just doselect * from table(fees), though. Is that feasible? - Alex Poole