A PolarDB for PostgreSQL(Compatible with Oracle) package consists of two main components: the package specification and the package body. This topic describes the basic information about the package specification and the package body.

  • Package specification syntax: This defines the public interface for a package. All the public elements in the package can be referenced from outside of the package. The specification declares all database objects that are included as part of the package.
  • Package body syntax: This contains the implementation details about all database objects that are declared within the package specification.

The package body implements the specifications in the package specification. It contains implementation details and private declarations that are invisible to external applications. Therefore, you can debug, enhance, or replace a package body without changing the specifications. You can also change the package body without recompiling the calling programs because the implementation details are invisible to these programs.