Drop table if exists before create
951969Jul 26 2012 — edited Jul 26 2012Hi, I need to translate the T-SQL to PL/SQL for droping if exists before creating table. but my trial below is not working. PLEASE HELP
---T-SQL
IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID('dbo.STUDENT') )
DROP TABLE [STUDENT]
GO
create table STUDENT(name varchar(12) NOT NULL);
GO
--PL/SQL
begin
execute immediate 'drop table STUDENT'; exception when others then null;
create table STUDENT(name varchar(12) NOT NULL);
end;