atif
atif

Reputation: 1147

XMLElementnot returning data in Oracle 10g

I am new to oracle and hence trying to write a query which will return xml from the relational table emp_metadata which has following columns emp_id and emp_name. The following query is returning null.

SELECT XMLElement("Emp", 
                   XMLElement("ID", e.emp_id),
                   XMLElement("Name", e.emp_name)) AS "RESULT" 
FROM emp_metadata e;

Any help or hint will be really appreciated.

Upvotes: 1

Views: 365

Answers (1)

atif
atif

Reputation: 1147

Get it resolved by converting the output using .getClobVal(). Below is the query

    SELECT XMLElement("Emp", 
                   XMLElement("ID", e.emp_id),
                   XMLElement("Name", e.emp_name))**.getClobVal()** AS "RESULT" 
     FROM emp_metadata e;

Upvotes: 3

Related Questions