DECLARE cnt NUMBER;BEGIN -- Check for the existence of the table SELECT COUNT(*) INTO cnt FROM all_tables WHERE table_name = 'YOUR_TABLE_NAME' AND owner = 'YOUR_SCHEMA_NAME';
-- If the table exists, then drop it IF cnt = 1 THEN EXECUTE IMMEDIATE 'DROP TABLE YOUR_TABLE_NAME'; END IF;EXCEPTION WHEN OTHERS THEN -- Handle exceptions if needed DBMS_OUTPUT.PUT_LINE('An error occurred: ' || SQLERRM);END;