Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to encapsulate code

Mark1970Jun 10 2010 — edited Jun 10 2010
I've tried this query written by Steven Feuerstein that should be usefull for identifying all programs where a table or a view is referenced directly instead of an encapsulation package:

Another kind of standard that might be set within an organization is that application
code should never reference a table or view directly but instead always go through
an encapsulation package. Here is a query that identifies all program
units that violate this rule:

SELECT owner || '.' || name refs_table,
referenced_owner || '.' ||
referenced_name table_referenced
FROM all_dependencies
WHERE owner LIKE UPPER ('&1')
AND TYPE IN ('PACKAGE',
*'PACKAGE BODY',*
*'PROCEDURE',*
*'FUNCTION')*
AND referenced_type IN ('TABLE', 'VIEW')
ORDER BY owner,
name,
referenced_owner,
referenced_name;

Sorry (perhaps) for the question but I can't get as it works.
The query seems to find those procedures where there is a reference to a table. But how could that be different? I mean it's obvoius since whithin a package there are statements refering directly a table. Where didn't I undestand?
Thanks!

Edited by: Mark1970 on 10-giu-2010 7.14
This post has been answered by SomeoneElse on Jun 10 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 8 2010
Added on Jun 10 2010
1 comment
626 views