Rohit
Rohit

Reputation: 39

Partitioned Index rebuild in Pl-sql block

I want to rebuild/unusable a partitioned index in pl-sql block. I have written in below code in pl-sql block,

declare     m_ErrorMsg varchar2(100);  
begin    
execute immediate
'Alter Index TCMS.TTC_PERF_IDX01 Rebuild Partition
TMP_TRN_CUSTOMER_0;';    
EXCEPTION WHEN OTHERS THEN
  m_ErrorMsg := SUBSTR(SQLERRM(SQLCODE), 1, 200) ;      
dbms_output.put_line(m_ErrorMsg);  
end;

Above code is giving exception: 'ORA-14010: this physical attribute may not be specified for an index partition'.

If I execute below command on Command Promt then it's working,

Alter Index TCMS.TTC_PERF_IDX01 Rebuild Partition TMP_TRN_CUSTOMER_0;

Please suggest me correct way to write it in plsql bloc.

Upvotes: 3

Views: 1787

Answers (1)

Ahmed Osama
Ahmed Osama

Reputation: 388

Clearly you cannot use ; with execute immediate clause. your statment should be:

execute immediate 'Alter Index TCMS.TTC_PERF_IDX01 Rebuild Partition TMP_TRN_CUSTOMER_0';

Upvotes: 1

Related Questions