SQL> select decode(count(0),0,'不存在','存在') T from user_tables where table_name = 'A';T
------
存在Executed in 0.016 secondsSQL> select decode(count(0),0,'不存在','存在') T from user_tables where table_name = 'AA';T
------
不存在Executed in 0.016 secondsSQL>
------
存在Executed in 0.016 secondsSQL> select decode(count(0),0,'不存在','存在') T from user_tables where table_name = 'AA';T
------
不存在Executed in 0.016 secondsSQL>
drop table 'TABLE1';
end if;不过与你的写法是一个意思来的,我怀疑是不是你运行存储过程的用户与TABLE1的用户不是同一个
drop 'TABLE1';
end if;
if exists(select 1 from tab where tname = upper(p_table)) then
v_strsql:='drop table' || p_table --拼sql
execute immediate v_strsql;
end if;
select * from ALL_CATALOG t
where t.owner='SYSTEM'
and t.table_type='TABLE'
and t.table_name='T_SYS_USER'
注意:'SYSTEM' 、'TABLE'、'T_SYS_USER'都必须是大写
通过ALL_CATALOG视图可以很准确的判断一个表是否存在
select count(*) into v_count from tab where tname=upper('table_name');
if v_count = 1 then
......
end if;