oracle - ORA-00979: 不是 GROUP BY 表达式 | 用户定义函数
问题描述
我有以下使用用户定义函数的查询。由于使用listagg
,我必须使用 ,group by
但我认为由于用户定义的功能,它在远程数据库中失败:
select p.player_code,
team_name,
listagg(case
when player_type = 'Def' and player_status in ('Fit', 'Mid-Fit')
then player_group_name
else null
end, ', ') within group (order by player_group_name) ctg,
schema_name.get_player_type_code@db_link(player_type, 'c')
from schema_name.team@db_link t
join schema_name.player@db_link p on t.team_id = p.player_team_id
left join(select distinct player_id, player_group_name
from schema_name.player@db_link i
join schema_name.player_sel@db_link ps on i.player_id = ps.player_sel_player_id
join schema_name.player_queue@db_link pq on ps.player_sel_queue_id = pq.queue_id
join schema_name.player_queue_group pqg on pq.queue_id = pqg.player_queue_group_queue_id
join schema_name.player_group pg on pqg.player_queue_group_group_id = player_group_id) ctg on p.player_id = ctg.player_id
group by p.player_code,
team_name,
schema_name.get_player_type_code@db_link(player_type, 'c');
此查询在我的主数据库中运行良好(不使用数据库链接)。但是,当我在远程数据库中运行它(使用数据库链接)时,它给了我以下错误:
ORA-00979: not a GROUP BY expression
如果我从我的查询中删除该功能(存在于主数据库中并且远程数据库具有执行此功能的正确权限。我可以毫无问题地从远程数据库执行该功能),它将在远程数据库中正常工作。但是当我把它放回查询中时,它会显示同样的错误。
想法?
解决方案
推荐阅读
- xslt - 如何使用 XSLT 1.0 将平面 XML 结构转换为分层 XML?
- vue.js - 如何在 Vuejs 中使用部署特定的 .env
- python - 将4个麻烦与垂直获胜条件连接起来
- java - 使用 OpenCv、NDK 和 Android 进行人脸识别
- google-apps-script - 将日期从电子表格导出到文本文件谷歌应用脚本
- php - 我是不是把 mimetype 设置错了?或者我需要做什么才能成功发送电子邮件
- multivalue - 如何在 AccuTerm 中禁用从 WED 编辑器编译
- android - 当我点击一个按钮重新开始时如何停止几个声音
- c# - Task.Run() 不会引发异常?
- javascript - 禁用输入字段后,角度(空格)键事件的行为类似于(选项卡)