Depends upon your database. You may be able to create a function that accepts a table name, then returns the rows. You'd then need to do something like
select * from myfunction(tablename)
All the accessible table names will need to be UNION compatible (same column names and data types).
Would be better to redefine the problem though.