Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oracle:从类型表插入_Oracle_Plsql_Insert_Bulkinsert - Fatal编程技术网

Oracle:从类型表插入

Oracle:从类型表插入,oracle,plsql,insert,bulkinsert,Oracle,Plsql,Insert,Bulkinsert,我想从表的类型插入到表中 有没有一种方法可以实现这一点?我可以稍微更改一下类型表内容吗 就像这里,但反过来说: 假设您有 CREATE TYPE my_nested_table_type AS TABLE OF <<something>>; DECLARE l_nt my_nested_table_type; BEGIN <<something that populates l_nt>> 谢谢,我在使用“FOR i IN 1..

我想从表的类型插入到表中

有没有一种方法可以实现这一点?我可以稍微更改一下类型表内容吗

就像这里,但反过来说:

假设您有

CREATE TYPE my_nested_table_type
    AS TABLE OF <<something>>;

DECLARE
  l_nt my_nested_table_type;
BEGIN
  <<something that populates l_nt>>

谢谢,我在使用“FOR i IN 1..DATA.COUNT循环”。“FORALL i in 1..DATA.COUNT”和我以前的解决方案有什么区别吗?关键字FORALL真的更快吗?@Fulley-the
FORALL
对数据进行大容量绑定。的
不可用。FORALL的
消除了SQL和PL/SQL之间额外的上下文转换。这可能会或可能不会导致有意义的绩效影响。这将取决于这些上下文占用了程序执行的多少部分shifts@JustinCave-你知道从什么时候起这是可能的吗?据我记忆所及,在早期的Oracle版本中,
FORALL
仅适用于像
这样的简单表类型。。。作为编号表
,但不适用于
等记录类型。。。例如,作为EMP%ROWTYPE的表。@Wernfried-您是在谈论PL/SQL中定义的集合吗?我很确定,自从
FORALL
问世以来,您已经能够使用任何SQL集合类型,无论是标量集合还是对象集合。@JustinCave-没错,集合类型是在PL/SQL块中定义的,甚至是作为
关联数组
,而不是
嵌套表
FORALL i in 1..l_nt.count
  INSERT INTO some_table( <<list of columns>> )
    VALUES( l_nt(i).col1, l_nt(i).col2, ... , l_nt(i).colN );