title: Dynamic SQL syntax using EXECUTE IMMEDIATE
body: <p>Dynamic SQL update statement as below:</p>
  
  <p><code>EXECUTE IMMEDIATE 'UPDATE '||l_prefix||'CRS_CUSTOMERS SET CUSTOMER_SOURCE_REF_ID = '||i.CUSTOMER_REF_ID||' WHERE CUSTOMER_ID = '||i.CUSTOMER_ID;</code></p>
  
  <p><code>l_prefix</code> is the parameter hold the prefix of table name, the value assigned is T_
  <code>i.CUSTOMER_REF_ID</code> and <code>i.CUSTOMER_ID</code> are the fields fetched from cursor.</p>
  
  <p>The dynamic statement encounter error <code>ORA-00904: invalid identifier</code> when data fetched.</p>
  
  <p>When rewrite it in static way, the query is working fine:</p>
  
  <p><code>UPDATE T_CRS_CUSTOMERS SET CUSTOMER_SOURCE_REF_ID = i.CUSTOMER_REF_ID WHERE
  CUSTOMER_ID = i.CUSTOMER_ID;</code></p>
  
  <p>I know it must be something wrong on the concatenation of dynamic SQL, just couldn't pinpoint any as the compilation is fine.</p>