Database Reference
In-Depth Information
The error message actually indicates that this works in both directions: you cannot reference individual
procedures or functions within a package either. If you try to reference a specific procedure in the package in another
stored unit of code you are going to receive an error:
SQL> create or replace function ANSWER return number
2 accessible by (pkg_5.pkg5_p1)
3 as
4 begin
5 return 42;
6 end;
7 /
Function created.
Notice how procedure pkg5_p1 of package pkg_5 is (theoretically) allowed to execute the function. In reality, it is
not (the package header is deliberately not shown).
SQL> CREATE OR REPLACE PACKAGE BODY PKG_5 as
2 procedure pkg5_p1 (pi_vc varchar2) as
3 the_answer number;
4 begin
5 the_answer := answer;
6 end pkg5_p1;
7 procedure pkg5_p2 (pi_n number) as begin null; end;
8 procedure pkg5_p3 as begin null; end;
9 end;
10 /
Warning: Package Body created with compilation errors.
SQL> show err
Errors for PACKAGE BODY PKG_5:
LINE/COL ERROR
-------- -----------------------------------------------------------------
5/5 PL/SQL: Statement ignored
5/19 PLS-00904: insufficient privilege to access object ANSWER
SQL>
So if you want to restrict access to a function to a specific piece of code you need to create this independently and
not within a package.
Other Improvements
There are many more improvements for developing Oracle database applications in the new release. Although they
are not directly related to consolidation they are noteworthy features . There is no particular order to these features,
the one thing they have in common is their usefulness.
As with every new feature it is just this one that makes you long for a migration to the current release. But this has
always been the case. The current problem one is working on is always solved, or at least less of an issue, with a future
version of the database you cannot currently use.
 
Search WWH ::




Custom Search