Subprograms Omitted from Specifications

Contact Us or call 1-877-932-8228
Subprograms Omitted from Specifications

Subprograms Omitted from Specifications

A subprogram can be declared in the package body but not in the package specification. It can only be called within the package itself (by itself or another subprogram). If you need to call your subprogram outside of the package itself, you must declare it in the package specification.

Code Sample:

Packages/Demos/call_test_package_f3_in_sql_error.sql
select test_package.f3() from dual;

Code Explanation

The function f3 is defined in the package body, but is not visible from outside the package because it is not defined in the package specification. Attempting to run this query results in an error.

Code Sample:

Packages/Demos/call_test_package_f4_in_sql.sql
select test_package.f4() from dual;

Code Explanation

The function f3 is visible to function f4, which is exposed in the package specification. This query will run successfully, and return a result from f3 through f4.

Next