DROP NAMESPACE Statement

You can remove a namespace by using the DROP NAMESPACE statement.

Syntax

drop_namespace_statement ::= 
   DROP NAMESPACE [IF EXISTS] namespace_name [CASCADE]

Semantics

IF EXISTS: This is an optional clause. If you specify this clause, and if a namespace with the same name does not exist, no error is generated. If you don't specify this clause, and if a namespace with the same name does not exist, an error is generated indicating that the namespace does not exist.

CASCADE: This is an optional clause that enables you to specify whether to drop the tables and their indexes in this namespace. If you specify this clause, and if the namespace contains any tables, then the namespace together with all the tables in this namespace will be deleted. If you don't specify this clause, and if the namespace contains any tables, then an error is generated indicating that the namespace is not empty.

Note:

You cannot drop the default namespace, sysdefault.

Example 3-4 Drop Namespace Statement

The following statement removes the namespace named ns1.
DROP NAMESPACE IF EXISTS ns1 CASCADE;