Yes you can obtain it from *_IDENTIFIERS
data dictionary view.
first set the PL/SQL compiler to analyze the identifiers of your program when it is compiled. See PL/Scope
ALTER SESSION SET
plscope_settings='IDENTIFIERS:ALL'
/
When PL/Scope is enabled and your program unit is compiled, the ALL_IDENTIFIERS
view is populated with information about all the identifiers found in that unit.
If I want to see all the declared variables in a program unit, I can execute this query:
SELECT ai.object_name
, ai.object_type
, ai.name variable_name
, ai.name context_name
FROM all_identifiers ai
WHERE ai.owner = USER AND
ai.TYPE = 'VARIABLE' AND
ai.usage = 'DECLARATION'
ORDER BY ai.object_name,
ai.object_type, ai.usage_id