Oracle 更新分区字段数据
准备工作
- 创建分区表
create table test_partition
(
id number,
code number
) partition by hash (code) partitions 4;
- 插入数据
insert into test_partition(id, code) values (1, 100);
insert into test_partition(id, code) values (2, 200);
实战
更新表 test_partition 的分区字段 code 的值
update test_partition set code = 101 where code = 100;
出现报错 “ORA-14402: 更新分区关键字列将导致分区的更改”
打开表的 row movement 属性来允许对分区字段的 update 操作
alter table test_partition enable row movement;
再次执行 update 语句,执行成功。
查看结果
select * from test_partition;