# 22. Virtuoso Functions Guide - XMLCONCAT

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
xmlagg
xmlattributes
xmladdattribute
xmlappendchildren
xmlconcat
xmlelement
xmlforest
xmlinsertafter
xmlinsertbefore
xmlreplace
xmltype.xmltype
xmltype.createnonsch...
xmltype.createschema...
xmltype.createxml
xmltype.existsnode
xmltype.extract
xmltype.getclobval
xmltype.getnamespace
xmltype.getnumval
xmltype.getrooteleme...
xmltype.getschemaurl
xmltype.getstringval
xmltype.isfragment
xmltype.isschemabase...
xmltype.isschemavali...
xmltype.isschemavali...
xmltype.schemavalida...
xmltype.setschemaval...
xmltype.toobject
xmltype.transform
xmlupdate
xper navigation
createxml
isentity
serialize_to_utf8_xm...
tidy_html
tidy_list_errors
updatexml
xml_add_system_path
xml_auto
xml_auto_dtd
xml_auto_schema
xml_create_tables_fr...
xml_cut
xml_doc_output_optio...
xml_get_system_paths
xml_load_mapping_sch...
xml_load_schema_decl
xml_namespace_scope
xml_persistent
xml_template
xml_tree
xml_tree_doc
xml_tree_doc_media_t...
xml_uri_get
xml_validate_dtd
xml_validate_schema
xml_view_dtd
xml_view_schema
xmlsql_update
xpath_eval
xper_cut
xper_doc
xper_locate_words
xpf_extension
xpf_extension_remove
xquery_eval
xslt
xslt_format_number
xslt_sheet
xslt_stale
xte_head
xte_node
xte_node_from_nodebl...
xte_nodebld_acc
xte_nodebld_final
xte_nodebld_init
xtree_doc
XPATH & XQUERY
Functions Index

## XMLCONCAT

Creates a forest of elements by concatenating a list of XML values
XMLCONCAT ( value_expr1 varchar, [value_expr2 varchar], [...], [value_exprN varchar]);
Description

XMLCONCAT 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. XMLCONCAT works like XMLFOREST, except that XMLCONCAT 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.

Parameters
value_expr1 – a vector returned by XMLELEMENT, XMLFOREST, or XMLCONCAT functions, or an entity object returned by corresponding functions (e.g. xtree_doc, xquery_eval or path_eval). In the latter case the entity object must not be an attribute.
Errors

SQLState | Error Code | Error Text | Description
--- | --- | --- | ---
22003 | SR355 | Too few arguments for XMLCONCAT | There must be at least one argument
22003 | SR359 | Invalid argument type NVARCHAR (225) for arg N to XMLCONCAT | The entity object returned by xpath_eval must not be an attribute
22003 | SR360 | XMLCONCAT doesn't concatenate attributes | The entity object returned by xquery_eval must not be an attribute

Examples
XMLCONCAT() with two parameters

The following example produces an XML elements for the 'FName', 'LName', 'country' and 'nationality', concatenates the result, and creates a one-column result set:

    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.

See Also

XMLAGG()

XMLATTRIBUTES()

XMLELEMENT()

XMLFOREST()