- Code: Select all
begin
sql_stmt := 'select 'alter table '||table_owner||'.'||table_name||' move partition '||partition_name|| ' $3 tablespace PART_
DATA_' || PARTITION_YR || ' parallel $2;' from dba_tab_partitions where partition_name=part_rec.part_name and table_owner = '$SCH
' and table_name=part_rec.tab_name;';
execute immediate sql_stmt;
EXCEPTION WHEN NO_DATA_FOUND
THEN
NULL;
END;
Tim,
This peace of code is part of big script. It works if i remove the Execute Immediate part, means it works as follows
- Code: Select all
select 'alter table '||table_owner||'.'||table_name||' move partition '||partition_name|| ' $3 tablespace PART_
DATA_' || PARTITION_YR || ' parallel $2;' into incr2 from dba_tab_partitions where partition_name=part_rec.part_name and table_owner = '$SCH
' and table_name=part_rec.tab_name;';
EXCEPTION WHEN NO_DATA_FOUND
THEN
NULL;
But with the execute immediate it goves errors something like
sql_stmt := 'select 'alter table '||table_owner||'.'||table_name||' move partition '||partition_name|| ' compress tablespace PART_DATA_' || PARTITION_YR || ' parallel 4;' from dba_tab_partitions where partition_name=part_rec.part_name and table_owner = 'UBSDB_EOD' and table_name=part_rec.tab_name;';
*
ERROR at line 26:
ORA-06550: line 26, column 30:
PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
Can you help ?
Thanks
Sahib Singh