How to find all the tables and column names used in a SQL? It is on ORACLE database. Below is an SQL example.
SELECT A.ENAME, A.AGE as EMP_AGE, B
If you can convert your query into VIEW and then use INFORMATION_SCHEMA.VIEW_COLUMN_USAGE
Here is an example:
let's say your view name is ABC
then use this one
SELECT VIEW_NAME, TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.VIEW_COLUMN_USAGE WHERE VIEW_NAME = 'ABC'
Let me know if it works..