Oracle中的文本聚合子查询不起作用

克里斯托弗·杰克

我想对子查询进行文本聚合。

我回来的错误消息是

缺少WITHIN关键字

我的代码是

Select
    DISTINCT(sh.order_date) as OrderDate,
    sup.supplier_name as SupplierName,
    sh.sales_document_num as OrderNumber,
    pro.product_code as SKU,
    pro.long_description_1 as ProductName,
    po.order_number as PONumber,
    sh.delivery_name as Name,
    sh.address1 as Address1,
    sh.address2 as Address2,
    sh.address3 as City,
    sh.address5 as StateProv,
    sh.POSTCODE as Postalcode,
    sh.country_code as Country,
    sh.inv_contact_telephone_1 as Phone,
    sh.inv_contact_email as Email,                             
    'TBC' as SupplierDesc,
    pi.order_required as Quantity,
    (select LISTAGG(LARGE_TEXT) from sales_entity_data  where entity_key1 = '20817159') as Personlization,
    'TBC' as LeadTime
from
    sales_header sh
    left join customer c on sh.customer_account = c.customer_account
    left join sales_item si on sh.sales_document_num = si.sales_document_num
    inner join po_header po on sh.sales_document_num = po.sales_document_num
    left join product pro on si.product_code = pro.product_code
    left join po_item pi on po.order_number = pi.order_number and si.product_code = pi.product_code 
     and si.order_quantity = pi.order_required
    left join supplier sup ON po.supplier_account = sup.supplier_account
where
    Sh.sales_document_num = '20817159' 

任何帮助表示赞赏

戈登·利诺夫

正确的语法是:

select LISTAGG(LARGE_TEXT, ',') WITHIN GROUP (ORDER BY LARGE_TEXT)
---------------------------^ separator
--------------------------------^ ordering

也就是说,限制为LISTAGG()2000个字符的结果,因此您可能无法汇总“大”文本。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章