Deletes the specified catalog definition. You must delete all schemas and definitions contained in a catalog before you can delete that catalog. If other definitions exist that refer to the named catalog, the deletion fails. The DROP CATALOG statement lists all schemas and definitions that it is going to delete. You can roll back the statement if you do not want to delete these definitions.
1 – Environment
You can use the DROP CATALOG statement: o In interactive SQL o Embedded in host language programs to be precompiled o As part of a procedure in an SQL module o In dynamic SQL as a statement to be dynamically executed
2 – Format
(B)0[m[1;4mDROP[m[1m [1;4mCATALOG[m[1m <catalog-name> qwqwqqqqqqqqqqqqqqqwqwq>[m [1m [m [1mx tq> [1;4mCASCADE[m[1m qqqqu x [m [1m [m [1mx tq> [1;4mRESTRICT[m[1m [m [1mqqu x [m [1m [m [1mx mq> [1;4mIF[m[1m [1;4mEXISTS[m [1mqqj x [m [1mmqqqqqqqqqq<qqqqqqqqj[m (B)0[m[1mcatalog-name = [m [1m [m [1mqwqqqqqq> <name-of-catalog> qqqqqqqqqqqqqqwq>[m [1m x x [m [1m mq> " q> <alias>.<name-of-catalog> q>" qj [m [1m [m
3 – Arguments
3.1 – alias.name-of-catalog
Specifies a name for the attachment to the database. Always qualify the catalog name with an alias if your program or interactive SQL statements refer to more than one database. Separate the name of the catalog from the alias with a period, and enclose the qualified name in double quotation marks. You must issue a SET QUOTING RULES statement before you can qualify a catalog name with an alias.
3.2 – CATALOG
Syntax options: CASCADE | RESTRICT Performs a restricted delete by default. If you prefer to delete all definitions contained in the catalog, you can specify the DROP CATALOG CASCADE statement.
3.3 – catalog-name
Specifies the module catalog name.
3.4 – IF_EXISTS
Prevents SQL command language from displaying error messages if the referenced object does not exist in the database.
4 – Example
Example 1: Deleting a catalog The following statement deletes the catalog DEPT1 associated with the alias PERSONNEL_ALIAS: SQL> ATTACH 'ALIAS PERSONNEL_ALIAS FILENAME CORPORATE_DATA'; SQL> SET QUOTING RULES 'SQL99'; SQL> CREATE CATALOG "PERSONNEL_ALIAS.DEPT1"; SQL> SHOW CATALOG; Catalogs in database PERSONNEL_ALIAS "PERSONNEL_ALIAS.ADMINISTRATION" "PERSONNEL_ALIAS.RDB$CATALOG"" "PERSONNEL_ALIAS.DEPT1" SQL> DROP CATALOG "PERSONNEL_ALIAS.DEPT1"; SQL> SHOW CATALOG; Catalogs in database PERSONNEL_ALIAS "PERSONNEL_ALIAS.ADMINISTRATION" "PERSONNEL_ALIAS.RDB$CATALOG" SQL> DROP CATALOG "PERSONNEL_ALIAS.RDB$CATALOG"; %SQL-F-NODROPSYSCAT, Catalog "PERSONNEL_ALIAS.RDB$CATALOG" may not be dropped SQL>