declare
num number;
begin
select count(1) into num from all_tables where TABLE_NAME = 'TNAME';
if num>1 then
drop table tname;
end if;
end;
/
num number;
begin
select count(1) into num from all_tables where TABLE_NAME = 'TNAME';
if num>1 then
drop table tname;
end if;
end;
/
解决方案 »
- dblink相关的一个非常异常的问题,请大神指点!!!
- 尝试加载 Oracle 客户端库时引发 BadImageFormatException。如果在安装 32 位 Oracle 客户端组件的情况下以 64 位模式运
- ORA-00922: 选项缺失或无效
- oracle 合并 不同表字段
- 又一个很简单的oracle 小问题!!
- 难题,关于并发访问同一行数据问题????
- ORACLE数据块中的SCN是如何变化的?
- oracle数据库密码突然失效,如何找回呀?急!十分感谢!
- 我为什么每一次装上oracle816后,我的oms怎么才能用呢,需要配置什么和环境变量呢?
- oracle for in 游标问题
- 如何从SQLServer数据库定时备份数据到Oracle
- 请问如何查看Oracle的SQL语句操作提示?
需要在worksheet中可以正确执行,不抛出错误~~~
你在sql*plus里面运行
drop table units;
*
ERROR 位于第 6 行:
ORA-06550: 第 6 行, 第 1 列:
PLS-00103: 出现符号 "DROP"在需要下列之一时:
begin case declare exit
for goto if loop mod null pragma raise return select update
while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
2 num number;
3 begin
4 select count(1) into num from all_tables where TABLE_NAME = 'BB';
5 if num=1 then
6 execute immediate 'drop table bb';
7 end if;
8 end;
9 /PL/SQL procedure successfully completed
beckham的对,要用动态sql
看来分要给beckham了:~~