在ms sql2000里面可以这样判断一个表是否存在,然后把他删除.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TABLE2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[TABLE2]再oracle里面怎么写语句?
if exists(select * from sys.all_all_tables where table_name='要删的表名')
then
drop table 要删的表名 ;
end if
??
我用这个在PLSQLDev里面执行不能!!
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TABLE2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[TABLE2]再oracle里面怎么写语句?
if exists(select * from sys.all_all_tables where table_name='要删的表名')
then
drop table 要删的表名 ;
end if
??
我用这个在PLSQLDev里面执行不能!!
解决方案 »
- oracle 11g R2 能不能与 SQL SERVER 2012共存啊
- ORACLE不能执行这样子的函数吗?
- VC9使用OCCI创建表,代码有错误,求指正
- 帮我看看这个oracle存储过程哪里写错了(PL/SQL里)?
- 合并两个列的数据
- 按每日统计,没有这一日的也要显示,为0
- 求一SQL简单语句,立即结帖。
- 在pl/sql中怎样判断一个字符串是不是正确的日期
- 现在在ORACLE官方网站有一个Oracle9i Release2 for windows server 2003(64-bit) 的版本,是什么意思
- 请问各位sqlplus如何获得某个表的主键信息?
- 能不能建立一个存储过程,返回一个记录集?
- Oracle创建全文索引错误,提示没有权限?(散分)
select count(1) from all_tables where table_name='table' and owner='user'如果返回0表示没有该表
then
drop table ?
end if这样吗?
在ORACLE 中判断表的存在一般如下:
select count(*) into tempcount
from tab
where TNAME = 'xxx' ;
if tempcount >0
then
---在SQL中使用DLL语句需要使用动态SQL
execute immediate 'drop table xxxx';
end if ;
前提 你有DROP这个表的权限;