Wednesday, April 1, 2009

Drop table if exists in Oracle ? ORA-00933

DECLARE exists PLS_INTEGER;
BEGIN
select count(*) into exists from user_tables where table_name = 'TableName_';
if exists = 1 then
execute immediate 'drop table TableName_';
end if;
END;

No comments: