I have a question about running a Oracle DB query on multiple tables. Is there a way to make the table names variables to be iterated as opposed to having to state each table name?
Background Example
- There are a large number of tables (ex. TABLE_1...TABLE_100).
- Each of these tables are listed in the NAME column of another table (ex. TABLE_LIST) listing an even larger number of tables along with TYPE (ex. "Account")
- Each of these tables has columnn VALUE a boolean column, ACTIVE.
Requirements
- Query the TABLE_LIST by TYPE = 'Account'
- For Each table found, query that table for all records where column ACTIVE = 'N'
- Results show table NAME and VALUE from each table row where ACTIVE = 'N'.
Any tips would be appreciated.