我有一个表名测试,它有三列id,m_id和s_m_id
我正在执行以下查询
select id,test.nextval listagg(m_id || ',' || s_m_id, ';') within group (order by m_id) as merge_ids
from test t group by id
比我收到错误ORA - 这里不允许02287序号。
答案 0 :(得分:5)
你想要一次性做太多事情。为分组创建子查询并稍后添加序列号:
select id, test.nextval, merge_ids
from (
select id, listagg(m_id || ',' || s_m_id, ';') within group (order by m_id) as merge_ids
from test t
group by id
)