title: Getting the error: "ORA-20999: Failed to parse SQL query! <p>ORA-06550: line 3, column 25: ORA-00936: missing expression
body: <p>I am using Oracle Apex and creating a report based on returning sql from a plsql body.</p>
  
  <p>This is what my statement looks like:</p>
  
  <pre><code>DECLARE
      l_query varchar2(1000); 
  BEGIN
     l_query := 'SELECT ' || :P10_MYVAR || ' from dual ';
     return l_query;
  END;
  </code></pre>
  
  <p>I get the following error message:</p>
  
  <pre><code>ORA-20999: Parsing returned query results in "ORA-20999: Failed to parse SQL query! &lt;p&gt;ORA-06550: line 3, column 25: ORA-00936: missing expression&lt;/p&gt;".
  </code></pre>
  
  <p>If I try without any bind variables it compiles fine:</p>
  
  <pre><code>DECLARE
          l_query varchar2(1000); 
      BEGIN
         l_query := 'SELECT sysdate from dual ';
         return l_query;
      END;
  </code></pre>
  
  <p>I do not see why this error is happening. If I run the command directly in the database:</p>
  
  <pre><code>SELECT :P10_MYVAR from dual
  </code></pre>
  
  <p>This runs fine. Why am I getting this error?</p>