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
DROP CATALOG <catalog-name> -+-+---------------+-+->
| +-> CASCADE ----+ |
| +-> RESTRICT --+ |
| +-> IF EXISTS --+ |
+----------<--------+
catalog-name =
-+------> <name-of-catalog> --------------+->
| |
+-> " -> <alias>.<name-of-catalog> ->" -+
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>