oracle - 使用 PL/SQL 关联数组

标签 oracle plsql bulkinsert

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 关联数组,则可以使用批量处理将数据插入到使用 FORALL 的基础数据库表中。

oracle 文档在这里: 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)

这是一个有点笼统的答案,但你问了一个非常笼统的问题。

希望这有助于...

关于oracle - 使用 PL/SQL 关联数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7348526/

相关文章:

.net - 托管 ODP.NET 驱动程序未显示在数据源对话框中

sql - 元编程oracle sql select语句

mysql - 如何将多行插入 MySQL 表并返回新 ID?

c - SQL Server & ODBC 与 C 语言

oracle - 如何使用 SSIS 连接到 Oracle?我收到错误 : "tns listener was not given the service_name in connect_data"

c# - Linq-to-Entity 在插入 Oracle 时取回主键

oracle - 在 Oracle SQL Developer 1.5 中打印 Oracle Sys_refcursor

sql - ORA-00947 "not enough values"当 UPDATE 返回 BULK COLLECT INTO 用户创建的 TYPE TABLE 时

c++ - Oracle 数据库中的 urand

sql-server - SQL Server 批量插入是事务性的吗?