background image
<< DROP statements | DROP TABLE statement >>

DROP ROLE statement

<< DROP statements | DROP TABLE statement >>
Derby Reference Manual
55
the named or implied schema, an error (SQLSTATE 42704) will occur. An error will also
occur if there is more than one specific instance of the procedure in the named or implied
schema.
DROP ROLE statement
The DROP ROLE statement allows you to drop an SQL role.
Only the
database owner
can drop a role.
For more information on roles, see "Using SQL roles" in the Derby Developer's Guide.
Syntax
DROP ROLE
roleName
Dropping a role has the effect of removing the role from the database dictionary. This
means that no session user can henceforth set that role (see
SET ROLE statement
),
and any existing sessions that have that role as the current role (see
CURRENT_ROLE
function
) will now have a NULL CURRENT_ROLE. Dropping a role also has the effect of
revoking that role from any user and role it has been granted to. See
REVOKE statement
for information on how revoking a role may impact any dependent objects.
Example
DROP ROLE reader;
DROP SCHEMA statement
The DROP SCHEMA statement drops a schema. The target schema must be empty for
the drop to succeed.
Neither the APP schema (the default user schema) nor the SYS schema can be dropped.
Syntax
DROP SCHEMA
schemaName
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
required
Example
-- Drop the SAMP schema
-- The SAMP schema may only be deleted from the database
-- if no objects are defined in the SAMP schema.
DROP SCHEMA SAMP RESTRICT
DROP SEQUENCE statement
The DROP SEQUENCE statement removes a sequence generator that was created
using a
CREATE SEQUENCE statement
.
Syntax
DROP SEQUENCE [
schemaName
. ]
SQL92Identifier
RESTRICT
The sequence name is composed of an optional schemaName and a SQL92Identifier. If
a schemaName is not provided, the current schema is the default schema. If a qualified
sequence name is specified, the schema name cannot begin with SYS.
The RESTRICT keyword is required. If a trigger or view references the sequence
generator, Derby throws an exception.