注:此例子是基于我们开发平台的基础上进行java 上的实现。在oracle 10g 数据库上使用bulk insert进行操作。
------------------------------创建数据表----------------------
create table TB_USER
(
USER_ID NUMBER,
USER_NAME NVARCHAR2(50),
USER_PASS NVARCHAR2(50),
USER_AGE NUMBER,
USER_SEX NVARCHAR2(20)
)
----------创建TB_USER表的type 数组类型-------------
create or replace type t_list_id is table of number;
create or replace type t_list_name is table of NVARCHAR2(50);
create or replace type t_list_pass is table of NVARCHAR2(50);
create or replace type t_list_age is table of number;
create or replace type t_list_sex is table of NVARCHAR2(50);
--------------------对应的存储过程--------------------------
create or replace procedure pro_forall_insert
(ids t_list_id,names t_list_name,passs t_list_pass,ages t_list_age,sexs t_list_sex)
as
begin
forall i in 1.. ids.count