2011-09-08 28 views
2
create or replace aArr is TABLE of varchar2 index by binary_integer; 
create or replace bArr is TABLE of varchar2 index by binary_integer; 

create or replace prc(oname aArr, iname bArr) as 
begin 

--Now i have two arrays 
-- i want to insert or update into table using these two arrays 
-- How can i do that with out using the loops. 
-- is there any bulk insert or update. 

end 

現在我有兩個數組。我想用這兩個數組插入或更新到表中。我怎樣才能做到這一點,使用循環?是否有任何批量插入或更新?使用PL/SQL關聯數組

回答

7

如果您有PL/SQL關聯數組,則可以使用批量處理將數據插入到使用FORALL的底層數據庫表中。

的甲骨文documantation是在這裏: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/forall_statement.htm

的語法類似於:

FORALL x IN INDICES OF <associative_array_name> 
    -- DML (INSERT or UPDATE etc) 

這是一個有點通用的答案,但你問一個非常通用的問題。

希望這有助於...