This topic introduces the concept of packages in PolarDB-O. A package is a named collection of functions, procedures, variables, cursors, user-defined record types, and records that are referenced by using a common qualifier, the package identifier.

Packages have the following characteristics:
  • Packages provide a convenient means of organizing the functions and procedures that perform a related purpose. Permissions to use the package functions and procedures are dependent upon one privilege granted to the entire package. All of the package programs must be referenced with a common name.
  • Certain functions, procedures, variables, and types in the package can be declared as public. Public entities are visible and can be referenced by other programs that are given the EXECUTE privilege on the package. For public functions and procedures, only their signatures are visible: the program names, parameters if any, and return types of functions. The SPL code of these functions and procedures is not accessible to others, therefore applications that utilize a package are dependent only upon the information available in the signature instead of the procedural logic itself.
  • Other functions, procedures, variables, and types in the package can be declared as private. Private entities can be referenced and used by functions and procedures within the package, but not by other external applications.
  • Function and procedure names can be overloaded within a package. One or more functions or procedures can be defined with the same name, but with different signatures. This provides the capability to create identically named programs that perform the same job, but on different types of input.