The DROP PACKAGE statement is used to remove a stored package from the database. This statement removes both the package header and the package body.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition only provides MySQL-compatible mode.
Notice
Do not use this statement to drop a single object from a package. Instead, use the CREATE PACKAGE statement with the OR REPLACE clause and the CREATE PACKAGE BODY statement to recreate the package without the object.
Prerequisites
The package must be in the current user's schema, or the user must have the ALTER ANY PACKAGE system privilege.
Syntax
The syntax for drop_package is as follows:
DROP PACKAGE [ BODY ] [ schema. ] package ;
Semantics
| Syntax | Keyword or syntax node | Description |
|---|---|---|
| drop_package | BODY | Drops only the package body. If this clause is omitted, the database will drop both the package header and the package body. When only the package body is dropped without dropping its header, the database does not invalidate dependent objects. However, before the package body is recreated, the stored procedures and functions declared in the package header cannot be called. |
| drop_package | schema | The schema name where the package is located. The default value is the current user's schema. |
| drop_package | package | The name of the package to be dropped. The database invalidates any local objects that depend on the package header. If these objects are subsequently referenced, the database will attempt to recompile them. If the dropped package has not been recreated, an error will be returned. If any statistics types are associated with the package, the database will dissociate the statistics types from the FORCE clause and delete any user-defined statistics collected using those statistics types. |
Examples
Drop the package obdemo_pack.
DROP PACKAGE obdemo_pack;