create or replace package employee_associative as
type t_employeeid is table of
employee.employeeid%type index by binary_integer;
type t_employeename is table of
employee.employeename%type index by binary_integer;
type t_salary is table of
employee.salary%type index by binary_integer;
procedure bulk_insert(
p_employeeid in t_employeeid,
p_employeename in t_employeename,
p_salary in t_salary
);
end employee_associative;
/
create or replace package body employee_associative as
procedure bulk_insert(
p_employeeid in t_employeeid,
p_employeename in t_employeename,
p_salary in t_salary) is
begin
forall i in p_employeeid.first..p_employeeid.last
insert into employee(employeeid,employeename,salary)
values(p_employeeid(i),p_employeename(i),p_salary(i));
end bulk_insert;
end employee_associative;
/
手順3
ストアドプロシージャにPL/SQL配列を値として渡すコードは以下になります。
Dim cnn As New OracleConnection( _
"user id=scott;password=tiger;data source=orcl")
Dim cmd As New OracleCommand( _
"employee_associative.bulk_insert", cnn)
cmd.CommandType = CommandType.StoredProcedure
Dim p_employeeid As New OracleParameter
Dim p_employeename As New OracleParameter
Dim p_salary As New OracleParameter
OracleConnection cnn =
new OracleConnection(
"user id=scott;password=tiger;data source=orcl");
OracleCommand cmd = new OracleCommand(
"employee_associative.bulk_insert", cnn);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter p_employeeid = new OracleParameter();
OracleParameter p_employeename = new OracleParameter();
OracleParameter p_salary = new OracleParameter();