视图查询导致 Oracle SQL Developer 中出现奇怪的错误

发布于 2024-11-07 04:08:04 字数 703 浏览 6 评论 0原文

我必须编写一个 SQL 命令来查询数据库中的视图。我没有自己创建它们,也无权访问这些表。我们的软件制造商仅向我们提供视图。我正在使用 Oracle SQL Developer 3.0 进行查询。以下命令按预期完美运行:

SELECT * FROM EDBADM.VW_THEVIEWNAME

但是,当我要求某个列(称为 filename)不包含任何空值时:

SELECT * FROM EDBADM.VW_THEVIEWNAME WHERE filename IS NOT NULL;

.... 我收到以下错误:

ORA-00979:
00979. 00000 -  "not a GROUP BY expression"
*Cause:    
*Action:
Error in line: 3 column: 75

这对我来说似乎难以置信因为我的查询部分不涉及聚合。另外,当我查询文件名以匹配特定模式时:

SELECT * FROM EDBADM.VW_THEVIEWNAME WHERE filename LIKE 'abc%'

...我仍然得到文件名为NULL的结果行。

有没有可能视图的底层、不可访问的定义不正确,导致这种奇怪的行为?

I have to write an SQL command which queries a View in a database. I did not create them myself nor do I have access to the tables. Only the views are provided to us by our software manufacturer. I'm using Oracle SQL Developer 3.0 to query. The following command works flawlessly as expected:

SELECT * FROM EDBADM.VW_THEVIEWNAME

However, when I ask for a certain column (called filename) not to contain any null values:

SELECT * FROM EDBADM.VW_THEVIEWNAME WHERE filename IS NOT NULL;

.... I get the following error:

ORA-00979:
00979. 00000 -  "not a GROUP BY expression"
*Cause:    
*Action:
Error in line: 3 column: 75

This seems implausible to me as no aggregation is involved in my part of the query. Also, when I query for filename to match a certain pattern:

SELECT * FROM EDBADM.VW_THEVIEWNAME WHERE filename LIKE 'abc%'

... I still get result rows where filename is NULL.

Could it be possible that the underlying, inaccessible definition of the view is incorrect, leading to this strange behavior??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-11-14 04:08:04

您能发布您的视图的创建脚本吗?名为 filename 的列是否在名为 VW_THEVIEWNAME 的视图中显式声明?

Could you post the creation script of your view? Is the column called filename explicitally declared in the view called VW_THEVIEWNAME?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文