在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里面执行不能!!
解决方案 »
- FreeBSd amd64下多次安装oracle client均告失败,amd64下,能安装oci?
- 请问Oracle的全文检索是什么意思?
- 多表关联问题
- 查询数据 用时间作过滤条件 条件写的不对 怎么纠正阿
- 请问如何对一个表检索出排序后的前10条记录
- 9i导出表时提示“ora-00972 标识过长”错误
- 关于beofre insert的触发器
- 关于SQL server的视图转换为oracle视图的问题,不是一般的容易
- 请教:在developer2000中想做一个子程序,通过参数改变cursor的排序,可以吗
- 关于一个GROUP查询的问题.
- 能不能建立一个存储过程,返回一个记录集?
- 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这个表的权限;