I have a package:
CREATE PACKAGE my_pkg
IS
g_var NUMBER;
END;
/
Is there any way I can query SYS views, to find that this package has this global variable? I'm interested in explicit variable name and data type.
P.S. Parsing user_source does not count.
Edit: I would like to do that without introducing getter/setter functions.
There isn't a sys view that contains this information. The best you can probably do here is use user_source or all_source (I know you said that doesn't count, but I think it's the best you can do here).
With that said, if you use the standard g_ prefix for your globals, is parsing all_source really that bad? I would think you could write a PL/SQL to loop over the source and search for "g_". It'll probably take some tweaking and experimentation, but I think it's worth trying.
You can expose it with a function in the package:
And in the view
For my own reference, here is a query that gets that information from data dictionary -