Skip to content

Instantly share code, notes, and snippets.

@kleontev
Created July 20, 2022 14:17
Show Gist options
  • Save kleontev/159e3820d043a609a470d8f6afcd69dc to your computer and use it in GitHub Desktop.
Save kleontev/159e3820d043a609a470d8f6afcd69dc to your computer and use it in GitHub Desktop.
exchange partition; drop col from compressed table; ORA-14097: column type or size mismatch
cl scr
set echo on
drop table test_part_tab purge;
drop table test_exch_tab purge;
drop table test_exch_tab_no_c2 purge;
create table test_part_tab (
pkey int,
c1 int,
c2 int
)
-- table has to be compressed
row store compress basic
partition by range(pkey) (
partition p0 values less than (1),
partition p1 values less than (2)
);
create table test_exch_tab as select * from test_part_tab;
-- so far so good!
alter table test_part_tab exchange partition p0 with table test_exch_tab;
-- drop a dummy column
alter table test_part_tab drop column c2;
-- it is still there, not dropped but marked as unused instead,
-- because the table is compressed
select column_name from user_tab_cols where table_name = 'TEST_PART_TAB';
create table test_exch_tab_no_c2 as select * from test_part_tab;
-- ORA-14097
alter table test_part_tab exchange partition p1 with table test_exch_tab_no_c2;
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment