declare
iCount pls_integer := 0;
jCount pls_integer := 0;
begin
select count(1) into iCount from user_constraints t where t.constraint_name ='1234';
select count(1) into jCount from user_indexes t where t.index_name='1234';
if icount = 0 and jCount>0 then
execute immediate ' drop index 1234';
end if;
if icount = 0 then
execute immediate '
---创建的表的索引语句
create unique index 1234 on 表 (列)
tablespace 索引空间
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 4M
minextents 1
maxextents unlimited
)
';
end if;
end ;
/
转载于:https://blog.51cto.com/ahead51/856813