ORA-01791: not a SELECTed expression
Student表有3个字段:id,name,age
看这两个SQL语句
(1)select name from student order by id;
(2)select distinct(name) from student order by id;
执行结果你可能会说:
第1句返回以id排序的所有name字段
第2句返回以id排序的所有不重复的name字段.
但是执行结果不是这样的,第2句会报ORA-01791: not a SELECTed expression
原因:
一般来说,order by 的排序字段是可以不出现在select查询字段列表中的,但当查询中使用了DISTINCT或者GROUP BY子句时,order by中的排序字段就必须出现在select列表中,否则就会报上述错误.
第2句应改成 select distinct(name),id from student order by id
或者 select distinct(name) from student order by name
ORA-01791: not a SELECTed expression的更多相关文章
- ORA-01791: not a SELECTed expression 一种是不 bug 的 bug!
[ora11@lixora ~]$ !sql sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 27 09: ...
- [20170728]oracle保留字.txt
[20170728]oracle保留字.txt --//oracle有许多保留字,我印象最深的就是使用rman备份表空间test,test就是rman里面的保留字.--//还有rman也是rman里面 ...
- Visual Studio 2010 Shortcut
General Shortcut Description Ctrl-X or Shift-Delete Cuts the currently selected item to the clipboar ...
- 零元学Expression Blend 4 - Chapter 27 PathlistBox被Selected时的蓝底蓝框问题
原文:零元学Expression Blend 4 - Chapter 27 PathlistBox被Selected时的蓝底蓝框问题 最近收到网友Cloud的来信,询问我有关放进PathlistBox ...
- ORA 各种oraclesql错误
ORA-00001: 违反唯一约束条件 (.) ORA-00017: 请求会话以设置跟踪事件 ORA-00018: 超出最大会话数 ORA-00019: 超出最大会话许可数 ORA-00020: 超出 ...
- (转载)SQL Reporting Services (Expression Examples)
https://msdn.microsoft.com/en-us/library/ms157328(v=SQL.100).aspx Expressions are used frequently in ...
- Expression<Func<T,TResult>>和Func<T,TResult>
1.Expression<Func<T,TResult>>是表达式 //使用LambdaExpression构建表达式树 Expression<Func<int, ...
- Microsoft Word Regular Expression
Microsoft Word Regular Expression Word裏的正則表達式-不一樣的符號. 一.Normal Find and Replace 二.Search by using wi ...
- Oracle Ora 错误解决方案合集
注:本文来源于 < Oracle学习笔记 --- Oracle ORA错误解决方案 > ORA-00001: 违反唯一约束条件 (.)错误说明:当在唯一索引所对应的列上键入重复值时,会触发 ...
随机推荐
- 玲珑杯 ACM热身赛 #2.5 A 记忆化搜索+瞎搞
#include <cstdio> #include <vector> #include <iostream> #include <algorithm> ...
- poj 1182 (带权并查集)
食物链 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 71361 Accepted: 21131 Description ...
- JavaScript学习总结(六)——JavaScript判断数据类型总结
最近做项目中遇到了一些关于javascript数据类型的判断处理,上网找了一下资料,并且亲自验证了各种数据类型的判断,在此做一个总结吧! 一.JS中的数据类型 1.数值型(Number):包括整数.浮 ...
- 蓝桥杯—ALGO-18 单词接龙(DFS)
问题描述 单词接龙是一个与我们经常玩的成语接龙相类似的游戏,现在我们已知一组单词,且给定一个开头的字母, 要求出以这个字母开头的最长的“龙”(每个单词都最多在“龙”中出现两次) ,在两个单词相连时,其 ...
- 快速切题 sgu123. The sum
123. The sum time limit per test: 0.25 sec. memory limit per test: 4096 KB The Fibonacci sequence of ...
- SSH框架下载地址
Struts各版本下载地址: https://dist.apache.org/repos/dist/release/struts/ Spring各版本下载地址: http://repo.spring. ...
- DevExpress v17.2新版亮点—WPF篇(二)
用户界面套包DevExpress v17.2终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了DevExpress WPF v17.2 新的Hamburger Menu.Sched ...
- 2018-2019-2 网络对抗技术 20165202 Exp4 恶意代码分析
博客目录 一.实践目标 二.实践内容 1.系统运行监控 2.恶意软件分析 三.实验步骤 四.基础问题回答 五.遇到的问题及解决 六.实验总结 一.实践目标 监控你自己系统的运行状态,看有没有可疑的程序 ...
- jsp:incloud用法
为什么要用jsp:incloud 因为单独一个页面太大,需要嵌套子页面,当请求有父页面的时候,子页面会自动加载<jsp:include page="/agentProfitShareN ...
- Oracle text组件安装
1.目标:在数据库中,安装Oracle Text组件: 970473.1 MOS文档ID 2.组件相关视图:查询验证 #查询DB中的组件: #视图:USER_REGISTRY (注册) COM ...