Oracle數據庫刪除表前判斷表是否存在SQL
declare vCount int;
begin
select count(1) into vCount from user_all_tables where Table_name = upper('testtable01');
if(vCount > 0 ) then
execute immediate ('drop table testtable01');
end if;
end;
SqlServer數據庫刪除表前判斷表是否存在SQL
if exists (select * from dbo.sysobjects where id = object_id(N'testtable01') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table testtable01
PG數據庫刪除表前判斷表是否存在SQL
DROP TABLE IF EXISTS testtable01
DM數據庫刪除表前判斷表是否存在SQL
declare vCount int;
begin
select count(1) into vCount from user_all_tables where Table_name = upper('testtable01');
if(vCount > 0 ) then
execute immediate ('drop table testtable01');
end if;
end;
Mysql數據庫刪除表前判斷表是否存在SQL
DROP TABLE IF EXISTS testtable01