xml data using oracle
TRANSCRIPT
Storing & Retrieving XML data using Oracle
Date: 11-Jul-2009Place: St. Joseph’s College of Engineering
• Introduction - XML• Oracle’s XML Support• Storing XML Data• Retrieving XML Data• References• Q & A
Agenda
Next generation of storage format for Office products
Common platform for developing open standard applications
Widely accepted and driven by W3C (www.w3.org)
Interchange with External Organizations
XML DB – Native, flexible, high-performance, scalable storage & processing
Introduction - XML
Oracle’s XML Support
Creating Directory
CREATE DIRECTORY xmldir AS 'c:\txt\';
Creating Table to store XML content
CREATE TABLE mytable2 OF XMLType;
Inserting into XML Table from file
INSERT INTO mytable2 VALUES (XMLType(bfilename('XMLDIR', 'purchaseorder.xml'), nls_charset_id('AL32UTF8')));
Storing XML Data
Retrieving XML Data
To get Reference under PurchaseOrder
SELECT extract(OBJECT_VALUE, '/PurchaseOrder/Reference') from mytable2
To get all values under LineItem value 1
SELECT extract(OBJECT_VALUE, '/PurchaseOrder/LineItems/LineItem[1]') FROM mytable2;
To get all Description from the XML Table
SELECT extract(OBJECT_VALUE, '/PurchaseOrder/LineItems/LineItem/Description') FROM mytable2;
To get value of Description
SELECT extractValue(value(d),'/Description') FROM mytable2 p, table (xmlsequence(extract(p.object_value,'/PurchaseOrder/LineItems/LineItem/Description'))) d WHERE existsNode(p.object_value,'/PurchaseOrder[Reference="SBELL-2002100912333601PDT"]') = 1;
References
www.oracle.com/technology/tech/xml/xmldb/index.html
http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/toc.htm
http://www.w3.org/XML/
http://msdn.microsoft.com/hi-in/xml/default(en-us).aspx
http://apex.oracle.com/i/index.html
Q&A
Thanks for sharing your time with me
Wish you all the best