在11.2中,oracle新增了append_values提示,使得insert into values语句也可以使用直接路径插入。
在11.2中,oracle新增了append_values提示,使得insert into values语句也可以使用直接路径插入。
例子很简单:
sql> select * from v$version;
banner
oracle database 11g enterprise edition release 11.2.0.1.0 - 64bit production
pl/sql release 11.2.0.1.0 - production
core 11.2.0.1.0 production
tns for linux: version 11.2.0.1.0 - production
nlsrtl version 11.2.0.1.0 - production
sql> create table t_append (id number, name varchar(30));
表已创建。
sql> insert /+ append(a) / into t_append a
2 values (1, ‘abc’);
已创建 1 行。
sql> select * from t_append;
id name
--------------------------------------------------------------------------------
1 abc
sql> commit;
提交完成。
sql> insert /+ append(a) / into t_append a
2 select rownum + 1, tname
3 from tab
4 where rownum = 1;
已创建 1 行。
sql> select * from t_append;
select * from t_append
*
第 1 行出现错误:
ora-12838: 无法在并行模式下修改之后读/修改对象
sql> commit;
提交完成。
对比insert into values和insert into select语句后的结果可以清晰的看到,append提示对于insert into values语句无效,,数据仍然采用常规路径插入。
在11.2中使用append_values提示,才使得单条插入语句真正实现了直接路径方式:
sql> insert /+ append_values(a) / into t_append a
2 values (3, ‘append_value’);
已创建 1 行。
sql> select * from t_append;
select * from t_append
*
第 1 行出现错误:
ora-12838: 无法在并行模式下修改之后读/修改对象
sql> commit;
提交完成。
sql> select * from t_append;
id name
本文永久更新链接地址: