Toad World® Forums

DROP statement generated by TOAD


#1

When generating scripts for objects in TOAD for ORACLE, there is an option to generate DROP statement which is great. The DROP statement works fine when the object actually exists but errors out when the object does not exist (as expected). Other Quest products “TOAD for SQL Server” handle it differently. They first check if the object exist and only run the DROP statement if the object actually exist. I wish TOAD ORACLE would also do the same thing as done by TOAD for SQL SERVER.

Script Generated by TOAD for SQL Server:

IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N’[dbo].[MY_VIEW]’))
BEGIN
DROP VIEW [dbo].[MY_VIEW];
END
GO

Script Generated by TOAD for ORACLE:

DROP VIEW SCHEMA_NAME.MY_VIEW;


#2

Welcome to some few things that SQL Server database does better than Oracle database. Toad for Oracle would have to perform the drop inside anonymous PL/SQL block using native dynamic SQL (execute immediate) which is not a technique many DBA’s like/prefer.

Maybe it could be an option - since toad does not have all that many options :slight_smile: