我正在尝试运行下面的查询
select organization_id
, listagg(secondary_inventory_name, ',') within group(order by secondary_inventory_name) as the_list
from inv_secondary_inventories
group by organization_id
,但它一直给出这个错误:
oracle.xdo.servlet.data.DataException: oracle.xdo.XDOException: java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
我做错了什么?
答案 0 :(得分:-1)
select organization_id
, listagg(secondary_inventory_name, ',') within group(order by secondary_inventory_name) as the_list
from inv_secondary_inventories
group by organization_id
以上是您的查询。只需将listagg
语句放在方括号中,这将起到神奇的作用。
select organization_id
,( listagg(secondary_inventory_name, ',') within group(order by secondary_inventory_name) )as the_list
from inv_secondary_inventories
group by organization_id