declare iCount number; begin select count(*) into iCount from dbo.sysobjects a where a.name='tblBuy' and a.Type='U'; if iCount>0 then drop table tblBuy; commit; else null; end if; end;
declare iCount number; begin select count(*) into iCount from dbo.sysobjects a where a.name='TBLBUY'; if iCount>0 then execute immediate 'drop table tblBuy'; end if; end; /您需要有drop any table的权限。 注意,数据字典中都是大写的。
declare num number; begin select nvl(max(1),0) into num from user_tables where table_name='TBLBUY'; if num>0 then ... else ... end if; end; /
iCount number;
begin
select count(*) into iCount from dbo.sysobjects a where a.name='tblBuy' and a.Type='U';
if iCount>0 then
drop table tblBuy;
commit;
else
null;
end if;
end;
iCount number;
begin
select count(*) into iCount from dbo.sysobjects a where a.name='TBLBUY';
if iCount>0 then
execute immediate 'drop table tblBuy';
end if;
end;
/您需要有drop any table的权限。
注意,数据字典中都是大写的。
num number;
begin
select nvl(max(1),0) into num from user_tables where table_name='TBLBUY';
if num>0 then
...
else
...
end if;
end;
/
select COUNT(*) FROM TAB WHERE TNAME ='TBLBUY'