Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle XMLCONCAT Function      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: XMLCONCAT

Definition:
In Oracle PL/SQL, XMLCONCAT is a XML supported function which is used to combines multiple XMLType values to build up a concatenated XML structure.

Example Syntax:

XMLCONCAT (XMLType instance | XMLelement Type)


It can either accept a XMLType instance readily or an XMLelement Type. The XMLType function is used to typecast an input string as XMLType instance. This method uses XMLSequencetype to concatenate multiple XMLType instances. The XMLelement type is created out of the input column specified.

Example Usage

1. The query below combines XMLType instances using XMLSequencetype

SELECT 
XMLConcat(XMLSequenceType(
XMLType('<Site>www.psoug.org</Site>'),
XMLType('<Name>SBH</Name>')
)).getCLOBVal()
AS "XMLResult"
FROM DUAL
/

XMLResult
------------------------------------------------------
<Site>www.psoug.org</Site><Name>SBH</Name>



2. The query below combines several XMLElement inputs into a single XML structure.

SELECT XMLConcat(XMLElement("Employee Name", e.ename),
XMLElement("Salary", e.sal)) AS "XML Struct"
FROM emp e
/

XML Struct
----------------------------------------------------------------------
<Employee Name>SMITH</Employee Name><Salary>800</Salary>
<Employee Name>ALLEN</Employee Name><Salary>1600</Salary>
<Employee Name>WARD</Employee Name><Salary>1250</Salary>
<Employee Name>JONES</Employee Name><Salary>2975</Salary>
<Employee Name>MARTIN</Employee Name><Salary>1250</Salary>
<Employee Name>BLAKE</Employee Name><Salary>2850</Salary>
<Employee Name>CLARK</Employee Name><Salary>2450</Salary>
<Employee Name>SCOTT</Employee Name><Salary>3000</Salary>
<Employee Name>KING</Employee Name><Salary>5000</Salary>
<Employee Name>TURNER</Employee Name><Salary>1500</Salary>
<Employee Name>ADAMS</Employee Name><Salary>1100</Salary>
<Employee Name>JAMES</Employee Name><Salary>950</Salary>
<Employee Name>FORD</Employee Name><Salary>3000</Salary>
<Employee Name>MILLER</Employee Name><Salary>1300</Salary>

14 rows selected.


Related Links:
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 115 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?