SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
Oracle XML Handling
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.
Oracle XML Handling
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
Oracle XML Handling
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

Contenu connexe

Tendances (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
 

Similaire à Oracle XML Handling

Similaire à 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
 
XML for bioinformatics
XML for bioinformaticsXML for bioinformatics
XML for bioinformatics
 
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
 

Dernier

Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxEduSkills OECD
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17Celine George
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxAditiChauhan701637
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.raviapr7
 
Presentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphPresentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphNetziValdelomar1
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice documentXsasf Sfdfasd
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesCeline George
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationMJDuyan
 
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptxraviapr7
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxiammrhaywood
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfTechSoup
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptxmary850239
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17Celine George
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...Nguyen Thanh Tu Collection
 

Dernier (20)

Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptx
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.
 
Presentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphPresentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a Paragraph
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice document
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 Sales
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive Education
 
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptx
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
 

Oracle XML Handling

  • 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.
  • 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
  • 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;