DROP SCHEMA
Purpose
This statement deletes a schema and subsequently deletes all the objects with it.
Prerequisites
Physical Schema
- You need the system privilege
DROP ANY SCHEMA, or the schema must be owned by you or one of your assigned roles.
Virtual Schema
- You need the system privilege
DROP ANY VIRTUAL SCHEMA, or the schema must be owned by you or one of your assigned roles.
Syntax
drop_schema::=
Usage Notes
- A user can own arbitrary many schemas.
RESTRICTdeletes the schema only if it is empty.CASCADEdeletes the schema and subsequently deletes all objects contained in it. Additionally, all foreign key references to tables within the deleted schema are also removed.- If neither
CASCADEnorRESTRICTis specified, thenRESTRICTis applied by default. - If the optional clause
IF EXISTSis specified, then the statement will not throw an exception if the schema does not exist. - For details about the virtual schema concept, refer to Virtual Schemas section.
- If you specify the
FORCEoption in the statement, then the corresponding adapter script is not informed by that action. Otherwise, the adapter script will be called and there will be an action depending on its implementation.
Examples
DROP SCHEMA my_schema;
DROP SCHEMA IF EXISTS my_schema;
DROP SCHEMA my_schema CASCADE;
DROP VIRTUAL SCHEMA my_virtual_schema;