It looks like it's possible to have an Oracle command in C# which has an output parameter, however if it is I'm not sure how to wire it up.
The command:
declare
type new_rows is table of Table1%rowtype;
newRows new_rows;
type newKeys_rec is record (col1 number, col2 number);
type newKeys_type is table of newKeys_rec;
newKeys newKeys_type;
begin
select *
bulk collect into newRows
from Table2;
forall idx in 1..newRows.count()
insert into Table1
values newRows(idx)
returning Table1.col1, Table1.col2 bulk collect into newKeys;
end;
The command parameter in sql:
Parameters.Add(new OracleParameter
{
ParameterName = "newKeys",
ObjectTypeName = "newKeys_type",
OracleDbType = OracleDbType.Object,
Direction = ParameterDirection.Output
});
The error:
OCI-22303: type ""."NEWKEYS_TYPE" not found
UPDATE: Following upon the answers below:
1) Declare the type on the schema:
Create type Schema.newKeys_object as object (col1 number, Col2 number)
Create type Schema.newKeys_type as table of Schema.type1_object
2) In the OracleParameter:
Parameters.Add(new OracleParameter
{
ParameterName = "newKeys",
ObjectTypeName = "newKeys_type",
OracleDbType = OracleDbType.Table,
Direction = ParameterDirection.ReturnValue
});
CREATE TYPE new_rows IS table OF Table1%rowtype;