A complete solution that works without any special compilation flags
Here is a solution I developed for the jOOQ code generator in version 3.9 to detect PL / SQL RECORD types. It only detects the types that are actually referenced:
SELECT x.type_owner, x.type_name, x.type_subname, a.* FROM all_arguments a JOIN ( SELECT type_owner, type_name, type_subname, MIN(owner ) KEEP (DENSE_RANK FIRST ORDER BY owner, package_name, subprogram_id, sequence) owner, MIN(package_name ) KEEP (DENSE_RANK FIRST ORDER BY owner, package_name, subprogram_id, sequence) package_name, MIN(subprogram_id) KEEP (DENSE_RANK FIRST ORDER BY owner, package_name, subprogram_id, sequence) subprogram_id, MIN(sequence ) KEEP (DENSE_RANK FIRST ORDER BY owner, package_name, subprogram_id, sequence) sequence, MIN(next_sibling ) KEEP (DENSE_RANK FIRST ORDER BY owner, package_name, subprogram_id, sequence) next_sibling, MIN(data_level ) KEEP (DENSE_RANK FIRST ORDER BY owner, package_name, subprogram_id, sequence) data_level FROM ( SELECT LEAD(sequence, 1, sequence) OVER ( PARTITION BY owner, package_name, subprogram_id, data_level ORDER BY sequence ) next_sibling, a.type_owner, a.type_name, a.type_subname, a.owner, a.package_name, a.subprogram_id, a.sequence, a.data_level, a.data_type FROM all_arguments a ) a WHERE data_type = 'PL/SQL RECORD' GROUP BY type_owner, type_name, type_subname ) x ON (a.owner, a.package_name, a.subprogram_id) = ((x.owner, x.package_name, x.subprogram_id)) AND a.sequence BETWEEN x.sequence AND x.next_sibling AND a.data_level = x.data_level + 1 ORDER BY x.type_owner, x.type_name, x.type_subname, a.sequence ;
More on this above can be found here .
A relatively simple (but incomplete) solution, depending on a special compilation flag
I just discovered this extremely interesting website that lists a query that uses vocabulary representations here referred to in zep. . Using the package from the question, use this query:
WITH plscope_hierarchy AS (SELECT line , col , name , TYPE , usage , usage_id , usage_context_id FROM all_identifiers WHERE owner = USER AND object_name = 'MY_TYPES' AND object_type = 'PACKAGE') SELECT LPAD (' ', 3 * (LEVEL - 1)) || TYPE || ' ' || name || ' (' || usage || ')' identifier_hierarchy FROM plscope_hierarchy START WITH usage_context_id = 0 CONNECT BY PRIOR usage_id = usage_context_id ORDER SIBLINGS BY line, col;
Satisfying this result
PACKAGE MY_TYPES (DECLARATION) REFCURSOR T_CURSOR_TYPE (DECLARATION) NESTED TABLE T_TABLE_TYPE (DECLARATION)
Unfortunately, the type of the nested table is no longer allowed.