The DROP PACKAGE statement is used to delete a stored package from the database. This statement deletes both the package header and the package body.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Notice
Do not use this statement to drop a single object from a package. Instead, use the CREATE PACKAGE statement and the CREATE PACKAGE BODY statement with the OR REPLACE clause 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 of 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, the package header cannot be called until the package body is recreated. |
| drop_package | schema | The name of the schema 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 obdemo_pack package.
DROP PACKAGE obdemo_pack;
