自己写个存储过程,具体查询表是否存在可参考select count(1) from user_tables where table_name='表名';
楼主想用一个分号就搞定,我觉得是不可能的,如下可以参考:--判断表是否存在,如果存在则删除 declare num number; begin select count(1) into num from user_tables where TABLE_NAME = 'EMP'; if num=1 then execute immediate 'drop table EMP'; end if; end; /
楼主想用一个分号就搞定,我觉得是不可能的,如下可以参考:--判断表是否存在,如果存在则删除
declare
num number;
begin
select count(1) into num from user_tables where TABLE_NAME = 'EMP';
if num=1 then
execute immediate 'drop table EMP';
end if;
end;
/
存在则删除,不存在就报错,你可以后续捕捉异常