SQL/XMLSQL/XML or XML-Related Specifications is part 14 of the Structured Query Language (SQL) specification. In addition to the traditional predefined SQL data types like
SpecificationThe specification defines the data type Further information and examples of the SQL/XML functions are provided in the external links below[2][3][4]. Standard complianceThe result of Wagner's objective evaluation of the SQL/XML:2006 standard compliance of Oracle 11g Release 1, MS SQL Server 2008 and MySQL 5.1.30 is shown in the following table[2], to which the data for PostgreSQL 9.1,[5][6] and IBM DB2 has been added:
ExamplesThe sample SQLXML query below has SQLXML type as output(tested on DB2 9.7 and Oracle 11g): SELECT XMLELEMENT(NAMEs "PhoneBook", -- root element name
XMLAGG( -- aggregation over the rows
XMLELEMENT(NAME "Contact",
XMLATTRIBUTES(cust.FIRST_NAME AS "Name",
cust.TEL)
)
)
)
FROM TMP.CUSTOMER AS cust;
And the output: <PhoneBook>
<Contact Name="Daniel" TEL="788255855"/>
<Contact Name="Martin" TEL="889665447"/>
<Contact Name="Eva" TEL="111222333"/>
<Contact Name="Alena" TEL="444555666"/>
<Contact Name="Oliver" TEL="777888999"/>
<Contact Name="George" TEL="444882446"/>
<Contact Name="Jamie" TEL="123456789"/>
</PhoneBook>
Samples are taken from javalobby article[7]. References
External links
|
Portal di Ensiklopedia Dunia