SlideShare uma empresa Scribd logo
1 de 18
XML Storage Options:
1.   VARCHAR2 – unstructured, limited size
2.   CLOBs – unstructured, max file = 2GB
3.   XMLType – structured, associate with XDK and other XML
     operations


XML DB Architecture:
1.   XML DB Repository
2.   DOM fidelity
3.   SQL* Loader
   Using XMLTYPE

   XML Piecewise Update
    Update part of the xml document in the database specified by the
    XPath expression.

   XML Schema Validation
    Manually or automatically validate XML documents as they are
    inserted to the Database.

   XML Document Generation
    Generate XML data from database using normal SQL query.
Creating XMLType Column or table with optional
 XML Schema support

create table profile(
         pid number,
         pfile XMLType);                Declares XMLType Column

create table profile of XMLType;           Declares XMLType Table
                                           Not Recommended
create table profile of XMLType
         XMLSCHEMA “http://bumbus.ucdavis.edu/scholar.xsd”
         ELEMENT “UCLEADS”

                        Declares XMLType Table conformed to an XML
                        Schema and specific the root element of the xml
                        document to be inserted.
Storing XML document into the database
insert into profile                 Insert the whole XML document in
values(100, XMLType('               SQL query
          <ScholarProfile>
                    <ID>1</ID>
                    <LastName> Azzzr</LastName>
                    <FirstName>Hussain</FirstName>
                    <Email>fdsfsafafa@mail.com</Email>
                    <Major>Load Runner</Major>
                    <Grade>A</Grade>
          </ScholarProfile>‘ ));
Accessing XML data stored as XMLType instance
1. ExtractValue()
   - access the value of an XML node

2. ExistsNode()
   - check if a particular node existed

3. Exact()
   - extract a collection of XML nodes

4. XMLSequence()
   - converts a fragment of XML into a collection (a table) of
     XMLType instances.
SELECT
 extract(X.pfile,'UCLEADS/ScholarProfile/Major')
FROM profile X;



                                                   Results are returned as a
                                                   fragment of XML
SELECT extractValue(value(w),'/Major')
 FROM profile X,
 TABLE ( xmlsequence (
          extract(value(X),
          '/UCLEADS/ScholarProfile/Major'))) w;



                                     Values are extracted from the nodes of
                                     the XMLType table generated using the
                                     XMLSequence()
SELECT
   existsNode(x.pfile, '/UCLEADS/ScholarProfile/Major') SubFound,
   existsNode(x.pfile, '/UCLEADS/ScholarProfile[Major="ORACLE"]') MajorFound,
   existsNode(x.pfile, '/UCLEADS/ScholarProfile[Major="Oracle"]') MajorFound2
 FROM Profile1 X;




SELECT count(*)
  FROM Profile X
  WHERE existsNode(x.pfile, '/UCLEADS/ScholarProfile[Major="Oracle"‘]) =
1;
<EMPLOYEES>
    <EMP>
        <EMPNO>112</EMPNO>
        <EMPNAME>Joe</EMPNAME>
        <SALARY>50000</SALARY>
    </EMP>
    <EMP>
        <EMPNO>217</EMPNO>
        <EMPNAME>Jane</EMPNAME>
        <SALARY>60000</SALARY>
    </EMP>
    <EMP>
        <EMPNO>412</EMPNO>
        <EMPNAME>Jack</EMPNAME>
        <SALARY>40000</SALARY>
    </EMP>
</EMPLOYEES>
UPDATEXML takes as arguments an XMLType instance and an XPath-value pair and
returns an XMLType instance with the updated value



SELECT UPDATEXML(emp_col,
'/EMPLOYEES/EMP[EMPNAME="Joe"]/SALARY/text()', 100000,

'//EMP[EMPNAME="Jack"]/EMPNAME/text()','Jackson',

'//EMP[EMPNO=217]',
    XMLTYPE.CREATEXML('<EMP><EMPNO>217</EMPNO><EMPNAME>Jane<
    /EMPNAME>'))

FROM emp_tab e;
<EMPLOYEES>
    <EMP>                         <EMPLOYEES>
        <EMPNO>112</EMPNO>        <EMP>
        <EMPNAME>Joe</EMPNAME>    <EMPNO>112</EMPNO>
        <SALARY>50000</SALARY>    <EMPNAME>Joe</EMPNAME>
    </EMP>                        <SALARY>100000</SALARY>
                                  </EMP>
    <EMP>
                                  <EMP>
        <EMPNO>217</EMPNO>        <EMPNO>217</EMPNO>
        <EMPNAME>Jane</EMPNAME>   <EMPNAME>Jane</EMPNAME>
        <SALARY>60000</SALARY>    </EMP>
    </EMP>                        <EMP>
    <EMP>                         <EMPNO>412</EMPNO>
        <EMPNO>412</EMPNO>        <EMPNAME>Jackson</EMPNAME>
                                  <SALARY>40000</SALARY>
        <EMPNAME>Jack</EMPNAME>
                                  </EMP>
        <SALARY>40000</SALARY>    </EMPLOYEES>
    </EMP>
</EMPLOYEES>
CREATE VIEW new_emp_view
AS
SELECT


UPDATEXML(emp_col, '/EMPLOYEES/EMP/SALARY/text()', 0) emp_view_col


FROM emp_tab e
XML Piecewise Update


UPDATE profile t
 SET value(t) = updateXML(value(t),'/UCLEADS/ScholarProfile/Major/text()','CS')
 WHERE existsNode(value(t),
        '/UCLEADS/ScholarProfile[Major="Computer Science"]') = 1;


• isFragment() – returns (1) if the XMLType contains XML document fragment.
• getClobVal() – converts the XMLType document into CLOB object.
• getRootElement() – get the root element of the XML document.
• getNameSpace() – get the namespace of the root element of the XML
                   document.
select
     xmltype(xmltype.getclobVal(t.pfile)).getRootElement() Exmpl1,
    xmltype.getRootElement(t.pfile)Exmp2,
     xmltype.isFragment(t.pfile)isFrag1 ,
     xmltype.isFragment(extract(t.pfile,'/UCLEADS/ScholarProfile'))isFrag2

 from profile1 t;
azharpro@gmail.com

Mais conteúdo relacionado

Mais procurados (20)

Sequences and indexes
Sequences and indexesSequences and indexes
Sequences and indexes
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
Mysql
MysqlMysql
Mysql
 
4.3 MySQL + PHP
4.3 MySQL + PHP4.3 MySQL + PHP
4.3 MySQL + PHP
 
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V  Advanced PHP and MySQLFYBSC IT Web Programming Unit V  Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
 
Powerful Explain in MySQL 5.6
Powerful Explain in MySQL 5.6Powerful Explain in MySQL 5.6
Powerful Explain in MySQL 5.6
 
lab56_db
lab56_dblab56_db
lab56_db
 
MySQL for beginners
MySQL for beginnersMySQL for beginners
MySQL for beginners
 
Introduction to php database connectivity
Introduction to php  database connectivityIntroduction to php  database connectivity
Introduction to php database connectivity
 
ASP.Net Presentation Part2
ASP.Net Presentation Part2ASP.Net Presentation Part2
ASP.Net Presentation Part2
 
Lecture6 display data by okello erick
Lecture6 display data by okello erickLecture6 display data by okello erick
Lecture6 display data by okello erick
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
 
Java class 8
Java class 8Java class 8
Java class 8
 
Sqlxml vs xquery
Sqlxml vs xquerySqlxml vs xquery
Sqlxml vs xquery
 
Oracle views
Oracle viewsOracle views
Oracle views
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 

Semelhante a Oracle XML Handling

Semelhante a Oracle XML Handling (20)

DB2 Native XML
DB2 Native XMLDB2 Native XML
DB2 Native XML
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and Development
 
2.4 xml support
2.4 xml support2.4 xml support
2.4 xml support
 
PostgreSQL and XML
PostgreSQL and XMLPostgreSQL and XML
PostgreSQL and XML
 
Xml generation and extraction using XMLDB
Xml generation and extraction using XMLDBXml generation and extraction using XMLDB
Xml generation and extraction using XMLDB
 
DOSUG XML Beans overview by Om Sivanesian
DOSUG XML Beans overview by Om SivanesianDOSUG XML Beans overview by Om Sivanesian
DOSUG XML Beans overview by Om Sivanesian
 
Session06 handling xml data
Session06  handling xml dataSession06  handling xml data
Session06 handling xml data
 
R-XML.docx
R-XML.docxR-XML.docx
R-XML.docx
 
R-XML.docx
R-XML.docxR-XML.docx
R-XML.docx
 
Xml and databases
Xml and databasesXml and databases
Xml and databases
 
Xml 2
Xml  2 Xml  2
Xml 2
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
XML Data Using Oracle
XML Data Using OracleXML Data Using Oracle
XML Data Using Oracle
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
XML and Web Services
XML and Web ServicesXML and Web Services
XML and Web Services
 
Xml session
Xml sessionXml session
Xml session
 
Xml And JSON Java
Xml And JSON JavaXml And JSON Java
Xml And JSON Java
 
Day2 xslt x_path_xquery
Day2 xslt x_path_xqueryDay2 xslt x_path_xquery
Day2 xslt x_path_xquery
 
Sql2005 Xml
Sql2005 XmlSql2005 Xml
Sql2005 Xml
 
XML_schema_Structure
XML_schema_StructureXML_schema_Structure
XML_schema_Structure
 

Último

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 

Último (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 

Oracle XML Handling

  • 1.
  • 2. XML Storage Options: 1. VARCHAR2 – unstructured, limited size 2. CLOBs – unstructured, max file = 2GB 3. XMLType – structured, associate with XDK and other XML operations XML DB Architecture: 1. XML DB Repository 2. DOM fidelity 3. SQL* Loader
  • 3. Using XMLTYPE  XML Piecewise Update Update part of the xml document in the database specified by the XPath expression.  XML Schema Validation Manually or automatically validate XML documents as they are inserted to the Database.  XML Document Generation Generate XML data from database using normal SQL query.
  • 4. Creating XMLType Column or table with optional XML Schema support create table profile( pid number, pfile XMLType); Declares XMLType Column create table profile of XMLType; Declares XMLType Table Not Recommended create table profile of XMLType XMLSCHEMA “http://bumbus.ucdavis.edu/scholar.xsd” ELEMENT “UCLEADS” Declares XMLType Table conformed to an XML Schema and specific the root element of the xml document to be inserted.
  • 5.
  • 6. Storing XML document into the database insert into profile Insert the whole XML document in values(100, XMLType(' SQL query <ScholarProfile> <ID>1</ID> <LastName> Azzzr</LastName> <FirstName>Hussain</FirstName> <Email>fdsfsafafa@mail.com</Email> <Major>Load Runner</Major> <Grade>A</Grade> </ScholarProfile>‘ ));
  • 7. Accessing XML data stored as XMLType instance 1. ExtractValue() - access the value of an XML node 2. ExistsNode() - check if a particular node existed 3. Exact() - extract a collection of XML nodes 4. XMLSequence() - converts a fragment of XML into a collection (a table) of XMLType instances.
  • 8. SELECT extract(X.pfile,'UCLEADS/ScholarProfile/Major') FROM profile X; Results are returned as a fragment of XML
  • 9.
  • 10. SELECT extractValue(value(w),'/Major') FROM profile X, TABLE ( xmlsequence ( extract(value(X), '/UCLEADS/ScholarProfile/Major'))) w; Values are extracted from the nodes of the XMLType table generated using the XMLSequence()
  • 11. SELECT existsNode(x.pfile, '/UCLEADS/ScholarProfile/Major') SubFound, existsNode(x.pfile, '/UCLEADS/ScholarProfile[Major="ORACLE"]') MajorFound, existsNode(x.pfile, '/UCLEADS/ScholarProfile[Major="Oracle"]') MajorFound2 FROM Profile1 X; SELECT count(*) FROM Profile X WHERE existsNode(x.pfile, '/UCLEADS/ScholarProfile[Major="Oracle"‘]) = 1;
  • 12. <EMPLOYEES> <EMP> <EMPNO>112</EMPNO> <EMPNAME>Joe</EMPNAME> <SALARY>50000</SALARY> </EMP> <EMP> <EMPNO>217</EMPNO> <EMPNAME>Jane</EMPNAME> <SALARY>60000</SALARY> </EMP> <EMP> <EMPNO>412</EMPNO> <EMPNAME>Jack</EMPNAME> <SALARY>40000</SALARY> </EMP> </EMPLOYEES>
  • 13. UPDATEXML takes as arguments an XMLType instance and an XPath-value pair and returns an XMLType instance with the updated value SELECT UPDATEXML(emp_col, '/EMPLOYEES/EMP[EMPNAME="Joe"]/SALARY/text()', 100000, '//EMP[EMPNAME="Jack"]/EMPNAME/text()','Jackson', '//EMP[EMPNO=217]', XMLTYPE.CREATEXML('<EMP><EMPNO>217</EMPNO><EMPNAME>Jane< /EMPNAME>')) FROM emp_tab e;
  • 14. <EMPLOYEES> <EMP> <EMPLOYEES> <EMPNO>112</EMPNO> <EMP> <EMPNAME>Joe</EMPNAME> <EMPNO>112</EMPNO> <SALARY>50000</SALARY> <EMPNAME>Joe</EMPNAME> </EMP> <SALARY>100000</SALARY> </EMP> <EMP> <EMP> <EMPNO>217</EMPNO> <EMPNO>217</EMPNO> <EMPNAME>Jane</EMPNAME> <EMPNAME>Jane</EMPNAME> <SALARY>60000</SALARY> </EMP> </EMP> <EMP> <EMP> <EMPNO>412</EMPNO> <EMPNO>412</EMPNO> <EMPNAME>Jackson</EMPNAME> <SALARY>40000</SALARY> <EMPNAME>Jack</EMPNAME> </EMP> <SALARY>40000</SALARY> </EMPLOYEES> </EMP> </EMPLOYEES>
  • 15. CREATE VIEW new_emp_view AS SELECT UPDATEXML(emp_col, '/EMPLOYEES/EMP/SALARY/text()', 0) emp_view_col FROM emp_tab e
  • 16. XML Piecewise Update UPDATE profile t SET value(t) = updateXML(value(t),'/UCLEADS/ScholarProfile/Major/text()','CS') WHERE existsNode(value(t), '/UCLEADS/ScholarProfile[Major="Computer Science"]') = 1; • isFragment() – returns (1) if the XMLType contains XML document fragment. • getClobVal() – converts the XMLType document into CLOB object. • getRootElement() – get the root element of the XML document. • getNameSpace() – get the namespace of the root element of the XML document.
  • 17. select xmltype(xmltype.getclobVal(t.pfile)).getRootElement() Exmpl1, xmltype.getRootElement(t.pfile)Exmp2, xmltype.isFragment(t.pfile)isFrag1 , xmltype.isFragment(extract(t.pfile,'/UCLEADS/ScholarProfile'))isFrag2 from profile1 t;