Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: DROP table <some table>;
Gary M. Greenberg wrote:
> Now, I understand that the error is ignorable, but as a
> programmer it bothers me not to 1st check for the table's
> prior existence. So, how does one begin such a SQL script
> wherein the logic would be:
>
> if (<the table to be created> exists) then
> drop table <the table>
> end
> create table ...
You can try to use SELECT COUNT(*) INTO counter FROM USER_TABLES WHERE TABLE_NAME = <the table>;
if counter = 1 then
drop table <the table> CASCADE
end;
create table ...
--- Name : Lun Wing San Title : Oracle Application Developer of Hong Kong Productivity Council Oracle Database Administrator and System Administrator of QRC Phone : (852)27885841 This posting represents the personal opinions of the author. It is not the official opinion or policy of the author's employer. Warranty expired when you opened this article and I will not be responsible for its contents or use.Received on Fri Feb 14 1997 - 00:00:00 CST
![]() |
![]() |