SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt? (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
 

Ähnlich wie Oracle XML Handling

Ähnlich wie 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
 

Kürzlich hochgeladen

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 

Kürzlich hochgeladen (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
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
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 

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;