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> drop table countries;
Table dropped.
SQL>