Home » SQL & PL/SQL » SQL & PL/SQL » Passing record values to a stored procedure
Passing record values to a stored procedure [message #2741] Fri, 09 August 2002 04:08 Go to next message
Mark Grimshaw
Messages: 73
Registered: June 2002
Member
I want to insert a record into a table using stored procedure that accepts the fields of the record via its parameter list. I don't want to pass the parameters/fields of the new record in individually but as some sort of collection. Are my otions limited to a collection type such as a VARRAY or TABLE declared like the following in a package?:-

TYPE RecordTableT IS VARRAY(1) OF MY_TABLE%ROWTYPE;
or
TYPE RecordTableT IS TABLE OF MY_TABLE%ROWTYPE;

I ideally wanted to use the RECORD type but can't seem to get the syntax right or it is not possible with RECORD.

Has anyone got any better suggestions

Thank You
Re: Passing record values to a stored procedure [message #2744 is a reply to message #2741] Fri, 09 August 2002 09:41 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
You can use a RECORD type, but you will have to specify the columns.

In a package:

type MyRec is record (col1 number, col2 varchar2(10));


And then:

create or replace procedure test (p_rec in MyRec)...
Previous Topic: return a recordset in function
Next Topic: Setting variables
Goto Forum:
  


Current Time: Fri Apr 19 14:22:09 CDT 2024