how to retrive xml data for using sql query?

Answer Posted / d ashwin

SELECT XMLELEMENT
("Emp", XMLELEMENT("name", e.fname ||' '|| e.lname),
XMLELEMENT ( "hiredate", e.hire))
AS "RESULT"
FROM employees e
WHERE employee_id > 200 ;


This query produces the following typical XML result:

RESULT
-----------------
<Emp>
<name>John Smith</name>
<hiredate>2000-05-24</hiredate>
</Emp>
<Emp>
<name>Mary Martin</name>
<hiredate>1996-02-01</hiredate>
</Emp>

Is This Answer Correct ?    13 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to export data to a csv file?

636


How to view the data files in the current database?

608


How to pass parameters to procedures in oracle?

579


What are the ansi data types supported in oracle?

528


How to create a server parameter file?

582






How to build data dictionary view an new database?

544


In not less than 100 words what's the main difference between Rolap and Molap in ORACLE ?

1792


Explain what are the type of synonyms?

592


How to create an initialization parameter file?

548


What is a tns file?

511


How to define a sub function?

679


Design database draw er diagram for a certain scenario ?

4109


Can we create database in oracle using command line ?

594


How to create additional tablespaces for an new database?

583


What is the difference between substr & instr functions?

607