【发布时间】:2016-02-03 15:15:03
【问题描述】:
当我尝试在查询的 ELSE 部分中使用 listagg 选择语句时,我收到 ORA-00937 错误。有什么办法吗?
select
CASE
when count(*) = 0 then
'There are no users connected'
else
(select
listagg(osuser, ', ') within group (order by osuser)
from (select distinct osuser from v$session)
where osuser != 'SYSTEM' and osuser not like 'VMCONFTEST%')
end
from v$session
where username is not null
and osuser not like 'VMCONFTEST%';
即使我将 select 语句替换为更简单的语句,例如 select osuser from v$session,我也会遇到同样的错误。
【问题讨论】:
-
你如何通过执行
SELECT osuser FROM v$Session得到ORA-00937?