Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database and XML

Status
Not open for further replies.

kensington45

Technical User
Jun 26, 2008
9
0
0
I have one table with 10 fields and 100 records in Oracle 9i. I want to put the information in XML to be fetched later on another network into another Oracle 9i database.

Please advise if this is possible where I will get the 100 records with the 10 fields and transfer it over into XML?
I assume I can do it using Server side languages such as ColdFusion or Java?
 
Oracle has built in ways to do this. You can use SQLX, in which you change your query to return the xml structure you want, or you can also use Oracle's XDK.

SQLX example:
Code:
SELECT XMLELEMENT("PARTS",
          XMLAGG(
             XMLELEMENT("PART",
                XMLFOREST(NVL(unit_price, -999) "LIST_PRICE",
                          NVL(adjusted_unit_price, -999) "UNIT_PRICE")
             )
          )
       ).getClobVal()
  INTO v_return
  FROM qp_preq_lines_tmp
 ORDER BY line_index;
Code:
XDK example:
SELECT DBMS_XMLGEN.getxml('SELECT NVL(unit_price, -999) LIST_PRICE, NVL(adjusted_unit_price, -999) UNIT_PRICE
										 FROM qp_preq_lines_tmp
										ORDER BY line_index')
  INTO v_return
  FROM dual;

You can google for this, and find more documentation on these libraries. Hope this helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top