title: How to pass value in xmltable
body: <p>How can I pass a variable value inside the xpath of xmltable?</p>
  
  <pre><code>DECLARE
    v NUMBER := 0;
  BEGIN
    SELECT *
    FROM xml_billrun_files t ,
      xmltable('/invoice/AR_ITEMS[@elem='||v||']/ITEMS/USAGE_RECORDS/SESSION_INFO' 
                passing t.update_xmldoc 
                columns chrg_duration VARCHAR2(20) path 'DURATION', 
                        amount NUMBER path 'AMOUNT') x;
  END;
  </code></pre>
  
  <p>I've tried this one.</p>
  
  <pre><code>DECLARE
    v NUMBER := 0;
  BEGIN
    SELECT *
    FROM xml_billrun_files t ,
      xmltable('/invoice/AR_ITEMS[@elem=$i]/ITEMS/USAGE_RECORDS/SESSION_INFO' 
                passing t.update_xmldoc, xmltype(v) as "i"
                columns chrg_duration VARCHAR2(20) path 'DURATION', 
                        amount NUMBER path 'AMOUNT') x;
  END;
  </code></pre>
  
  <p>But it returns an error:</p>
  
  <pre><code>ORA-31011: XML parsing failed
  ORA-19202: Error occurred in XML processing
  LPX-00210: expected '&lt;' instead of '0'
  Error at line 1
  ORA-06512: at "SYS.XMLTYPE", line 310
  ORA-06512: at line 1
  ORA-06512: at line 5
  31011. 00000 -  "XML parsing failed"
  *Cause:    XML parser returned an error while trying to parse the document.
  *Action:   Check if the document to be parsed is valid.
  </code></pre>
  
  <p>thanks for the help. </p>