declare

     num number;

begin

    select count(1) into num from all_ind_columns where table_name = 'table1'(表名) and index_name= 'idx_table'(索引名);

    if num > 0 then

        execute immediate 'drop index idx_table'(删除索引的语句);

    end if;

end;

/

create index idx_table on table1 (name);

 

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐