AskTom笔记(2)

last updated 2005-04-04

key word : forall/delete/update


1.
http://asktom.oracle.com/pls/ask/f?p=4950:8:2228421416644702266::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:8912264456901
1)forall一次只能执行一个单一的语句,如果有多个insert/delete,必须使用多个forall
2)limit子句使用示例
//other statement
fetch c BULK COLLECT INTO data LIMIT 100;-- 每次100行
  begin
    FORALL i IN 1 .. data.count SAVE EXCEPTIONS
      insert into t2 values data(i);
//other statement

2.
如何删除大表中的大批量的数据
1)
create table new_table unrecoverable as select * from old_table where ....;
drop table old_table;
rename new_table to old_table;
create index old_table_idx1 on old_table(c1,c2) unrecoverable parallel 5;
.....
没有日志产生,只是把数据移动到新表上,drop/rename old/new,而且尽可能快的创建索引
2)
分区表.并行删除数据.每个分区会使用自身的回滚段,会以并行的方式执行.
3)
分区表以便使用DROP分区而不是使用DELETE删除数据.

3.
如何更新大表中的大批量数据
CREATE TABLE new_table as select from old_table;
index new_table
grant on new table
add constraints on new_table
etc on new_table
drop table old_table
rename new_table to old_table;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/6906/viewspace-21754/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/6906/viewspace-21754/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值