Dropping schemas

To delete a schema, use the DROP statement.

Before you begin

Before dropping a schema, all objects that were in that schema must be dropped or moved to another schema.

The schema name must be in the catalog when attempting the DROP statement; otherwise an error is returned.

Procedure

To drop a schema by using the command line, enter:
    DROP SCHEMA name RESTRICT

The RESTRICT keyword enforces the rule that no objects can be defined in the specified schema for the schema to be deleted from the database. The RESTRICT keyword is not optional.

Examples

In the following example, the schema "joeschma" is dropped:
    DROP SCHEMA joeschma RESTRICT