All Products
Search
Document Center

PolarDB:DROP PACKAGE BODY

Last Updated:Oct 27, 2025

DROP PACKAGE BODY is used to remove only the implementation part (BODY) of a package without affecting the definition (Spec). This feature enables you to manage the structure and logical implementation of packages more flexibly.

Prerequisites

The supported versions of PolarDB for PostgreSQL (Compatible with Oracle) are as follows:

  • Oracle syntax compatible 2.0 (minor engine version 2.0.14.17.34.0 and later)

Note

You can view the minor engine version in the console, or check it by using the SHOW polardb_version; statement. If the minor engine version requirement is not met, you can upgrade the minor engine version.

Benefits

  • Removes only the implementation part: DROP PACKAGE BODY provides a more granular management approach, deleting only the logical implementation part (BODY) of a package while preserving the integrity of the declaration part (Spec).

  • Ideal for dynamic package logic updates: When you need to adjust or refactor the implementation part of a package, you can first delete the existing BODY, and then create a new PACKAGE BODY.

  • Greater maintenance flexibility: Avoids unnecessarily deleting the entire package, thereby reducing the impact on the declaration part (interface).

Syntax

DROP PACKAGE BODY <package_name>;

Parameter description

Parameter

Description

package_name

The name of the PACKAGE BODY to be deleted.

Examples

Delete an existing PACKAGE BODY

DROP PACKAGE BODY TEST_PKG;
Note

The command above will remove the BODY of TEST_PKG, but its definition (Specification) will remain. The declared interfaces are not affected.

Delete a non-existent PACKAGE BODY

DROP PACKAGE BODY TEST_PKG_1;

Outputs

ERROR: Package "TEST_PKG_1" does not exist.