视图查询导致 Oracle SQL Developer 中出现奇怪的错误
我必须编写一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能发布您的视图的创建脚本吗?名为 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?