Must use 'a single-group group function' with xmlattribute : xmlattribute « XML « Oracle PL/SQL Tutorial






SQL> CREATE TABLE countries (
  2    country_id         CHAR(2),
  3    country_name       VARCHAR2(40),
  4    country_subregion  VARCHAR2(30),
  5    country_region     VARCHAR2(20)
  6  );

Table created.

SQL>
SQL> select xmlelement( "Country",
  2         xmlattributes(c.country_region as "Region"),
  3         xmlagg(xmlelement("Country",xmlforest(c.country_name as "Name"))))
  4  from countries c
  5  /
       xmlattributes(c.country_region as "Region"),
                     *
ERROR at line 2:
ORA-00937: not a single-group group function


SQL>
SQL>
SQL> drop table countries;

Table dropped.

SQL>








33.10.xmlattribute
33.10.1.Create xml attribute with xmlattribute function
33.10.2.Must use 'a single-group group function' with xmlattribute