--Bulk insert into table from an array. insertinto department_teststruct select*fromtable(cast(d2 as dept_array));
更新:
UPDATE Table1 O SET Col2 = NVL((select Col2 fromtable(p_inventory_array_in) T WHERE O.Col1 = T.Col1), Col2);
不能使用下面的方法来更新
UPDATE Table1 -- Error: PL/SQL: SQL Statement ignored SET Col2 = T. Col2 FROM Table1 O, (SELECT*FROMTABLE(p_array_in)) T --Error: PL/SQL: ORA-00933: SQL command not properly ended WHERE O. Col1 = T. Col1;
我们可以使用两个数租来进行更新,
forall i in1..array1.Count update table1 set col2 = array2(i) where col1 = array1(i);
前面我已经告诉大家如何在Oracle中向Collection类型的变量中逐条插入数据, 如何在Oracle中修改Collection类型的变量。现在要变被动为主动,如何以Collection为数据源来处理真实数据表中的数据。插入:--Bulk insert into table from an array.insert into department_teststruct selec