xml data using oracle

8
Storing & Retrieving XML data using Oracle Date: 11-Jul-2009 Place: St. Joseph’s College of Engineering

Upload: csenthilmurugan

Post on 06-Aug-2015

51 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: XML Data Using Oracle

Storing & Retrieving XML data using Oracle

Date: 11-Jul-2009Place: St. Joseph’s College of Engineering

Page 2: XML Data Using Oracle

• Introduction - XML• Oracle’s XML Support• Storing XML Data• Retrieving XML Data• References• Q & A

Agenda

Page 3: XML Data Using Oracle

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

Page 4: XML Data Using Oracle

Oracle’s XML Support

Page 5: XML Data Using Oracle

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

Page 6: XML Data Using Oracle

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;

Page 7: XML Data Using Oracle

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

Page 8: XML Data Using Oracle

Q&A

Thanks for sharing your time with me

Wish you all the best