DECLARE
NUM NUMBER;
BEGIN
NUM:=0;
SELECT COUNT(1) INTO NUM FROM USER_TABLES WHERE TABLE_NAME='XXX';
IF NUM>0 THEN
EXECUTE IMMEDIATE 'DROP TABLE XXX';
END IF;
EXECUTE IMMEDIATE 'CREATE TABLE....';
END;
DECLARE
NUM NUMBER;
BEGIN
NUM:=0;
SELECT COUNT(1) INTO NUM FROM USER_SEQUENCES WHERE SEQUENCE_NAME='XXX';
IF NUM>0 THEN
EXECUTE IMMEDIATE 'DROP SEQUENCE XXX';
END IF;
EXECUTE IMMEDIATE 'CREATE SEQUENCE ....';
END;
DECLARE
NUM NUMBER;
BEGIN
NUM:=0;
SELECT COUNT(1) INTO NUM FROM USER_INDEXES WHERE INDEX_NAME='XXX';
IF NUM>0 THEN
EXECUTE IMMEDIATE 'DROP INDEX XXX';
END IF;
EXECUTE IMMEDIATE 'CREATE INDEX ...';
END;