title: Convert XML Type to VARCHAR
body: <p>I am trying to convert the data extracted from XMLTYPE column to varchar but it gives me error:</p>
  
  <pre><code>SELECT TO_CHAR(EXTRACT (XML_DATA, '/root/MYData/text()'))
    FROM TBL_DATA
  </code></pre>
  
  <p>Gives error "Inconsistent datatypes: expected NUMBER got - "</p>
  
  <p>My motive is to put the extracted value into a variable and use it further in stored proc and the node can contain number or alphabets:</p>
  
  <pre><code>SELECT TO_CHAR(EXTRACT (XML_DATA, '/root/MYData/text()')) INTO TEMP_VAR
    FROM TBL_DATA
  </code></pre>