title: Select common columns from two tables
body: <p>I have two tables</p>
  
  <ol>
  <li>temp_data_holder</li>
  <li>temp_data_holder1</li>
  </ol>
  
  <p>These two tables will have some common columns but they can also have some extra columns which might be present in only one table. I need a query which will select the common columns from each table.</p>
  
  <p>I can get the common column names using the following query</p>
  
  <pre><code>Select column_name 
  from all_tab_columns 
  where table_name like 'temp_data_holder' 
  intersect 
  Select column_name 
  from all_tab_columns 
  where table_name like 'temp_data_holder1';
  </code></pre>
  
  <p>Is there a way to use this query to get the resultant columns from each table?</p>
  
  <p>I'm asking for something like this</p>
  
  <p><code>Select columns=(Select column_name from all_tab_columns where table_name like 'temp_data_holder' intersect Select column_name from all_tab_columns where table_name like 'temp_data_holder1') from temp_data_holder;</code></p>
  
  <p>I.e. the tables will be inside a for loop and the structure will change after each iteration so i cannot simply hard-code the column names</p>