title: Oracle merge statement within procedure fails to recognize variable in using clause
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6762376/upsert-into-table-with-dynamic-table-name">UPSERT into table with dynamic table name</a>  </p>
  </blockquote>
  
  
  
  <p>The following procedure is declared as so:  </p>
  
  <pre><code>CREATE OR REPLACE  
  PROCEDURE STUFF(tableToQuery VARCHAR2) AS  
  BEGIN  
      MERGE INTO myTable m  
      USING (select * from tableToQuery)  t  
      ON (m.id = t.id)  
  ...  --other stuff
  END STUFF;
  </code></pre>
  
  <p>I receive an ORA-00903 error that states the table name is invalid.  My question is how do I get the value that resides within <code>tableToQuery</code> to equate to a valid table name in the select statement?  Assume that I do not know the table name ahead of time.</p>
  
  <p><strong>UPDATE</strong>  </p>
  
  <p>The function compiles now, however I currently receive the unknown keyword error at the end of my function.</p>