I am trying to fetch column value from all the tables of database where column value matches.
Table A
CAMPUS_ID
1
Table B
CAMPUS_ID
1
Expected Result
TABLE VALUE
A 1
TABLE VALUE
B 1
Query
SELECT CAMPUS_ID FROM (SELECT A.TABLE_NAME FROM
user_tables A JOIN user_tab_columns C ON C.TABLE_NAME =
A.TABLE_NAME WHERE C.COLUMN_NAME = 'CAMPUS_ID')
WHERE CAMPUS_ID = '1'
Error Invalid Identifier
Inner query return the correct tables.
value
column in the expected result? That will never be different to the one you want to put in the WHERE clause. What if there are multiple rows wherecampus_id = 1
in those tables? What if there are no rows at all that match that condition?