select a.* from ( select TABLE_NAME from USER_TAB_COLUMNS where COLUMN_NAME='HGT') a where HGT is not null;
There is obviously something wrong with the syntax of this SQL, because I get an Oracle error, ORA-00904, saying that the HGT is an invalid identifier.
You will have to break your query up into two steps. The first query will obtain the table name(s) from the dictionary. The second query will utilize a separate subselect for every table found by the first query, and combine the subselects with UNION.
I'm afraid there's no way to query metadata and data at the same time, not if querying the data is driven by results from the metadata query.
Dig Deeper on Oracle development languages
Related Q&A from Rudy Limeback
Read an example of an SQL case expression from our SQL expert Rudy Limeback. Continue Reading
Read SQL expert Rudy Limeback's advice for counting combinations in a table with SQL's GROUP BY clause Continue Reading
Read about the Mimer Validator, a tool used to verify your SQL code, in this tip from SQL expert Rudy Limeback. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.