ORA-00937:不是单个组函数(XMLAGG)

时间:2015-09-24 14:00:47

标签: xml oracle-xml-db

我在一行中使用了XMLAGG聚合函数,并且我不断收到错误代码ORA-00937。为什么呢?

报告的结构是:

<Forms>
    <Year>2015</Year>
    <Month>September</Month>
    <Date>2015-09-22</Date>
    <Form>A1</Form>
    <Form>B4</Form>
    …
</Forms>

我的选择陈述是:

SELECT XMLSERIALIZE(
  DOCUMENT XMLROOT(
     XMLELEMENT("Forms",XMLATTRIBUTES('http://www.w3.org/2001/XMLSchema-    instance' AS "xmlns:xsi"),
         XMLELEMENT("Year", b.Year),
         XMLELEMENT("Month", b.Month),
         XMLELEMENT("Date", b.r_modify_date),
            XMLAGG(XMLELEMENT"Form",b.docnum))               
       ), 
      )  
    ) 
 FROM xml_bill  b
 where trunc(b.R_MODIFY_DATE) =trunc(sysdate);

1 个答案:

答案 0 :(得分:1)

所以我在WHERE子句中添加了GROUP BY,并在SELECT语句中修改了XMLELEMENT(“Date”,trunc(b.r_modify_date)

以下是新查询:

character1.characterid, character1.name,
character2.characterid, character2.name, 
winrate of character1 over character2