Skip to content

plscope_tab_usage ignores object tables #65

@rvo-cs

Description

@rvo-cs

Example:

Using utPLSQL, release 3.1.12, installed in the UT3 schema.

exec plscope_context.set_attr('OWNER', 'UT3');
exec plscope_context.set_attr('OBJECT_TYPE', 'PACKAGE BODY');
exec plscope_context.set_attr('OBJECT_NAME', 'UT_SUITE_CACHE_MANAGER');

select line,
       col,
       operation,
       ref_owner,
       ref_object_type,
       ref_object_name,
       direct_dependency,
       text
  from plscope.plscope_tab_usage
 where procedure_name = 'SAVE_OBJECT_CACHE'
 order by line,
       col,
       ref_owner,
       ref_object_type,
       ref_object_name;

Results:

LINE    COL    OPERATION    REF_OWNER    REF_OBJECT_TYPE    REF_OBJECT_NAME           DIRECT_DEPENDENCY    TEXT                                                               
    285     19 DELETE       UT3          TABLE              UT_SUITE_CACHE_PACKAGE    YES                        delete from ut_suite_cache_package t                         
    293     14 SELECT       UT3          TABLE              UT_SUITE_CACHE_PACKAGE    YES                          from ut_suite_cache_package t                              
    299     35 UPDATE       UT3          TABLE              UT_SUITE_CACHE_SCHEMA     YES                          update /*+ no_parallel */ ut_suite_cache_schema t          
    304     42 INSERT       UT3          TABLE              UT_SUITE_CACHE_SCHEMA     YES                            insert /*+ no_parallel */ into ut_suite_cache_schema     
    309     36 UPDATE       UT3          TABLE              UT_SUITE_CACHE_PACKAGE    YES                          update  /*+ no_parallel */ ut_suite_cache_package t        
    315     42 INSERT       UT3          TABLE              UT_SUITE_CACHE_PACKAGE    YES                            insert /*+ no_parallel */ into ut_suite_cache_package    

Expected;

LINE    COL    OPERATION    REF_OWNER    REF_OBJECT_TYPE    REF_OBJECT_NAME           DIRECT_DEPENDENCY    TEXT                                                               
    281     19 DELETE       UT3          TABLE              UT_SUITE_CACHE            YES                        delete from ut_suite_cache t                                 
    285     19 DELETE       UT3          TABLE              UT_SUITE_CACHE_PACKAGE    YES                        delete from ut_suite_cache_package t                         
    293     14 SELECT       UT3          TABLE              UT_SUITE_CACHE_PACKAGE    YES                          from ut_suite_cache_package t                              
    299     35 UPDATE       UT3          TABLE              UT_SUITE_CACHE_SCHEMA     YES                          update /*+ no_parallel */ ut_suite_cache_schema t          
    304     42 INSERT       UT3          TABLE              UT_SUITE_CACHE_SCHEMA     YES                            insert /*+ no_parallel */ into ut_suite_cache_schema     
    309     36 UPDATE       UT3          TABLE              UT_SUITE_CACHE_PACKAGE    YES                          update  /*+ no_parallel */ ut_suite_cache_package t        
    315     42 INSERT       UT3          TABLE              UT_SUITE_CACHE_PACKAGE    YES                            insert /*+ no_parallel */ into ut_suite_cache_package    
    320     21 DELETE       UT3          TABLE              UT_SUITE_CACHE            YES                          delete from ut_suite_cache t                               
    324     40 INSERT       UT3          TABLE              UT_SUITE_CACHE            YES                          insert /*+ no_parallel */ into ut_suite_cache t            
    350     40 INSERT       UT3          TABLE              UT_SUITE_CACHE            YES                          insert /*+ no_parallel */ into ut_suite_cache t            

UT_SUITE_CACHE is an object table, and as such, is not listed in DBA_TABLES 1.

For that reason, as of v1.0.0, it is ignored by plscope_tab_usage, which only takes into account tables from DBA_TABLES.

Footnotes

  1. Object tables are treated specially in the data dictionary: they appear in DBA_OBJECTS with object_type = 'TABLE', but they are not listed in DBA_TABLES. Instead, they are found in the DBA_OBJECT_TABLES and DBA_ALL_TABLES views. Further, their "columns" are listed in DBA_TAB_COLUMNS, yet PL/Scope records references to these columns as "object attribute references", not as "column references" as it would for columns of ordinary tables.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions