...
select count(*) into v_exist from tab where table_name='YOU_TABLE';
if v_exist>0 then
execute immediate 'drop table your_table';
...
select count(*) into v_exist from tab where table_name='YOU_TABLE';
if v_exist>0 then
execute immediate 'drop table your_table';
...
解决方案 »
- 求解决:Oracle 安装 , general_purpose.dbc不存在!
- oracle sql developer 每次启动都要出现选择 java.exe路径
- Oracle 从表table中 随机查询10条数据
- 优化ORACLE库数据查询问题
- ORA-01033 ORACLE initialization or shutdown in progress
- 存储过程中的sql语句问题
- 在oracle的pl/sql中如何实现对动态表的查询?
- 超级头疼:Oracle => SQL Server
- 请教ORACLE的数据导出问题,如何使速度更快!
- oracle 表空间如何建立
- 我用oracle8i+win2k 连接数据库出现问题,
- 在INTERNET网络上安装ORACLE?
str := 'declare ';
str := str||' num number;';
str := str||' begin ';
str := str||' select count(*) into num from tabs where tablespace_name = ''ZFJC'' and table_name = ''temp_1112'';';
str := str||' if num>0 then';
str := str||' drop table temp_1112;';
str := str||' end if;';
str := str||' end;';
dbms_output.put_line(str);
execute immediate str;
commit;
但它执行时给我这样的错误提示:
ORA-06550: 第 1 行, 第 139 列:
PLS-00103: 出现符号 "DROP"在需要下列之一时:
begindeclareexitforgotoif
loopmodnullpragmaraisereturnselectupdatewhile<an identifier>
<a double-quoted delimited-identifier><a bind variable><<
closecurrentdeletefetchlockinsertopenrollbacksavepointsetsql
executecommitforall<a single-quoted SQL string>
ORA-06512: 在"ZFJC.TEST123", line 47
ORA-06512: 在line 1
就是drop一个表,用的着你那么一堆吗?
select count(*) into num from tabs where table_name = 'temp_1112';
if num>0 then
execute immediate 'drop table temp_1112';
end if ;
commit;