1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-->
<refentry id="fn_XMLCONCAT">
<refmeta>
<refentrytitle>XMLCONCAT</refentrytitle>
<refmiscinfo>xml</refmiscinfo>
</refmeta>
<refnamediv>
<refname>XMLCONCAT</refname>
<refpurpose>Creates a forest of elements by concatenating a list of XML values</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_XMLCONCAT">
<funcprototype id="fproto_XMLCONCAT">
<funcdef><function>XMLCONCAT</function></funcdef>
<paramdef><parameter>value_expr1</parameter> varchar</paramdef>
<paramdef><optional><parameter>value_expr2</parameter> varchar</optional></paramdef>
<paramdef><optional><parameter>...</parameter></optional></paramdef>
<paramdef><optional><parameter>value_exprN</parameter> varchar</optional></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_XMLCONCAT"><title>Description</title>
<para>
<function>XMLCONCAT</function> accepts a list of XML value expressions as its arguments, and produces a forest of elements by
concatenating the XML values that are returned from the same row to make one value.
<function>XMLCONCAT</function> works like <function>XMLFOREST</function>,
except that <function>XMLCONCAT</function> parameters is a list of XML elements.
Null expressions are dropped from the result. If all the value expressions are null, then the function returns NULL.
</para>
</refsect1>
<refsect1 id="XMLCONCAT"><title>Parameters</title>
<refsect2><title>value_expr1</title>
<para>a vector returned by <function>XMLELEMENT</function>, <function>XMLFOREST</function>,
or <function>XMLCONCAT</function> functions, or an entity object returned by
corresponding functions (e.g. <function>xtree_doc</function>, <function>xquery_eval</function> or <function>path_eval</function>).
In the latter case the entity object must not be an attribute.
</para>
</refsect2>
</refsect1>
<refsect1 id="errors_XMLCONCAT">
<title>Errors</title>
<table><title>Errors signalled by <function>XMLCONCAT</function></title>
<tgroup cols="4">
<thead>
<row>
<entry>SQLState</entry><entry>Error Code</entry><entry>Error Text</entry><entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><errorcode>22003</errorcode></entry>
<entry><errorcode>SR355</errorcode></entry>
<entry><errorname>Too few arguments for XMLCONCAT</errorname></entry>
<entry>There must be at least one argument</entry>
</row>
<row>
<entry><errorcode>22003</errorcode></entry>
<entry><errorcode>SR359</errorcode></entry>
<entry>Invalid argument type NVARCHAR (225) for arg N to XMLCONCAT</entry>
<entry>The entity object returned by <function>xpath_eval</function> must not be an attribute</entry>
</row>
<row>
<entry><errorcode>22003</errorcode></entry>
<entry><errorcode>SR360</errorcode></entry>
<entry>XMLCONCAT doesn't concatenate attributes</entry>
<entry>The entity object returned by <function>xquery_eval</function> must not be an attribute</entry>
</row>
</tbody>
</tgroup>
</table>
</refsect1>
<refsect1 id="XMLCONCAT"><title>Examples</title>
<example id="ex_XMLCONCAT"><title>XMLCONCAT() with two parameters</title>
<para>
The following example produces an XML elements for the 'FName', 'LName', 'country' and
'nationality', concatenates the result, and creates a one-column result set:
</para>
<screen>
select XMLCONCAT (
XMLELEMENT ('FName', "FirstName"),
XMLELEMENT ('LName', "LastName"),
xquery_eval('//country', xtree_doc('<a><country>USA</country></a>')),
xpath_eval('//nationality', xtree_doc('<a><nationality>RUSSIAN</nationality></a>')))
from "Demo"."demo"."Employees";
callret
VARCHAR
_______________________________________________________________________________
<FName>Nancy</FName><LName>Davolio</LName><country>USA</country><nationality>RUSSIAN</nationality>
<FName>Andrew</FName><LName>Fuller</LName><country>USA</country><nationality>RUSSIAN</nationality>
. . .
<FName>Anne</FName><LName>Dodsworth</LName><country>USA</country><nationality>RUSSIAN</nationality>
9 Rows.
</screen>
</example>
</refsect1>
<refsect1 id="seealso_XMLCONCAT"><title>See Also</title>
<para><link linkend="fn_XMLAGG">XMLAGG()</link></para>
<para><link linkend="fn_XMLATTRIBUTES">XMLATTRIBUTES()</link></para>
<para><link linkend="fn_XMLELEMENT">XMLELEMENT()</link></para>
<para><link linkend="fn_XMLFOREST">XMLFOREST()</link></para>
</refsect1>
</refentry>
|