DROP DATALAKE SCHEMA statement

The statement is used to DROP a Datalake schema.

Invocation

This statement can only be executed as a dynamic statement using EXECUTE IMMEDIATE. It is an executable statement that can be dynamically prepared only if DYNAMICRULES run behavior is in effect for the package (SQLSTATE 42509).

Authorization

When dropping a Datalake schema, the privileges held by the authorization ID of the statement must include at least one of the following authorities:
  • Owner of the object, as recorded in the OWNER column of the catalog view for the object
  • DBADM authority

Syntax

Read syntax diagramSkip visual syntax diagramDROP DATALAKE SCHEMA ON DB2 SCHEMAIF EXISTSschema-nameRESTRICT

Description

DATALAKE
This keyword is required when dropping a Datalake schema.
IF EXISTS

Specifies that no error message is shown if the specified Datalake schema does not exist in the current database.

Unless other conditions or dependencies prevent the drop operation, a successful message is returned even if no Datalake schema is dropped. The condition for the failure is ignored if the Datalake schema does not exist.

schema-name
Identifies the particular Datalake schema to be dropped. The schema-name must identify a Datalake schema that is described in the catalog (SQLSTATE 42704).
RESTRICT
The RESTRICT keyword enforces the rule that no Datalake objects can be defined in the specified Datalake schema for the Datalake schema to be deleted from the database (SQLSTATE 42893).

Notes

  • If a schema is not empty, it cannot be dropped.

Examples

  • Example 1: Dropping the Datalake schema.
    DROP DATALAKE SCHEMA ON DB2 SCHEMA myschema RESTRICT 
  • Example 2: Drop possible without restrict option.
    DROP DATALAKE SCHEMA ON DB2 SCHEMA IF EXISTS myschema 
  • Example 3: Drop only if exists.
    DROP DATALAKE SCHEMA ON DB2 SCHEMA IF EXISTS myschema RESTRICT