sql - Is it possible to use column values to determine the tablename in a from clause of a subselect? -


i run query uses column value (in tablename stored) determine tablename in clause of subselect.

something that:

select column_with_tablename,

(select count(*) valueof(column_with_tablename)) numberofitems

from table1

i know fragile need work. (i inherited database stores tablenames in column)

is there way ?

for pure sql solution, refer this answer

select column_with_tablename,        to_number(extractvalue(xmltype          (dbms_xmlgen.getxml('select count(*) c '||column_with_tablename)          ),'/rowset/row/c')) count table1 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -