- 浏览: 1147417 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (411)
- Java Foundation (41)
- AI/机器学习/数据挖掘/模式识别/自然语言处理/信息检索 (2)
- 云计算/NoSQL/数据分析 (11)
- Linux (13)
- Open Source (12)
- J2EE (52)
- Data Structures (4)
- other (10)
- Dev Error (41)
- Ajax/JS/JSP/HTML5 (47)
- Oracle (68)
- FLEX (19)
- Tools (19)
- 设计模式 (4)
- Database (12)
- SQL Server (9)
- 例子程序 (4)
- mysql (2)
- Web Services (4)
- 面试 (8)
- 嵌入式/移动开发 (18)
- 软件工程/UML (15)
- C/C++ (7)
- 架构Architecture/分布式Distributed (1)
最新评论
-
a535114641:
LZ你好, 用了这个方法后子页面里的JS方法就全不能用了呀
页面局部刷新的两种方式:form+iframe 和 ajax -
di1984HIT:
学习了,真不错,做个记号啊
Machine Learning -
赵师傅临死前:
我一台老机器,myeclipse9 + FB3.5 可以正常使 ...
myeclipse 10 安装 flash builder 4.6 -
Wu_Jiang:
触发时间在将来的某个时间 但是第一次触发的时间超出了失效时间, ...
Based on configured schedule, the given trigger will never fire. -
cylove007:
找了好久,顶你
Editable Select 可编辑select
ORA-00979: not a GROUP BY expression
当用到组函数时,出现在select列表中的字段,如果没有在组函数中,那么必须出现在group by子句中!
Cause:The GROUP BY clause does not contain all the expressions in the SELECT clause. SELECT expressions that are not included in a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, must be listed in the GROUP BY clause.
Action:Include in the GROUP BY clause all SELECT expressions that are not group function arguments.
ORA-00937: not a single-group group function
如果在select列表项中除了包含聚合函数外,还包含了表的某些列,那么你将必须使用group by语句。
Cause:A SELECT list cannot include both a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, and an individual column expression, unless the individual column expression is included in a GROUP BY clause.
Action:Drop either the group function or the individual column expression from the SELECT list or add a GROUP BY clause that includes all individual column expressions listed.
在where子句和group by子句中不允许使用聚合函数,否则会报:
ORA-00934: group function is not allowed here
Cause:One of the group functions, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, was used in a WHERE or GROUP BY clause.
Action:Remove the group function from the WHERE or GROUP BY clause. The desired result may be achieved by including the function in a subquery or HAVING clause.
http://techonthenet.com/oracle/errors/ora00934.php
引用
Cause:You tried to execute an SQL statement that included one of the group functions (ie: MIN, MAX, SUM, COUNT) in either the WHERE clause or the GROUP BY clause.
Action:The options to resolve this Oracle error are:
1 Try removing the group function from the WHERE clause or GROUP BY clause. If required, you can move the group function to the HAVING clause.
For example, if you tried to execute the following SQL statement:
You could correct this statement by using the HAVING clause as follows:
2 You could also try moving the group by function to a subquery.
For example, if you tried to execute the following SQL statement:
You could correct this statement by using a subquery as follows:
Action:The options to resolve this Oracle error are:
1 Try removing the group function from the WHERE clause or GROUP BY clause. If required, you can move the group function to the HAVING clause.
For example, if you tried to execute the following SQL statement:
SELECT department, SUM(sales) as "Total sales" FROM order_details WHERE SUM(sales) > 1000 GROUP BY department;You will receive the error "ORA-00934: group function is not allowed here"
You could correct this statement by using the HAVING clause as follows:
SELECT department, SUM(sales) as "Total sales" FROM order_details GROUP BY department HAVING SUM(sales) > 1000;
2 You could also try moving the group by function to a subquery.
For example, if you tried to execute the following SQL statement:
SELECT department, SUM(sales) as "Total sales" FROM order_details WHERE SUM(sales) > 1000 GROUP BY department;You will receive the error "ORA-00934: group function is not allowed here"
You could correct this statement by using a subquery as follows:
SELECT order_details.department, SUM(order_details.sales) as "Total sales" FROM order_details, (select department, SUM(sales) as Sales_compare FROM order_details GROUP BY department) subquery1 WHERE order_details.department = subquery1.department AND subquery1.Sales_compare > 1000 GROUP BY order_details.department;
本博客相关解释:http://wuaner.iteye.com/blog/513099
引用
Illegal Queries Using Group Functions:
- You cannot use the WHERE clause to restrict groups. (即where子句中不允许使用聚合函数)
- You use the HAVING clause to restrict groups.(可以使用having子句为聚合函数加限定条件)
- You cannot use group functions in the WHERE clause.(即where子句中不允许使用聚合函数)
- You cannot use the WHERE clause to restrict groups. (即where子句中不允许使用聚合函数)
- You use the HAVING clause to restrict groups.(可以使用having子句为聚合函数加限定条件)
- You cannot use group functions in the WHERE clause.(即where子句中不允许使用聚合函数)
group by和order by的列可以不在select中;
用到了聚合函数并同时使用group by和order by时,select和order by中不在聚合函数里的columns必须都出现在group by中!
如,下面的写法会报“not a GROUP BY expression”:
select deptno, sum(sal) from emp group by deptno order by deptno,job
正确的写法是:
select deptno, sum(sal) from emp group by deptno,job order by deptno,job
发表评论
-
Oracle: minus | in | exists
2012-09-05 13:49 1461解释及例子: MINUS Query: http://www. ... -
一个奇怪的Oracle sql问题
2011-01-13 16:13 1359select A.M,B.N from Table1 A ... -
Oracle Analytic Functions:RANK, DENSE_RANK, FIRST and LAST;PARTITION BY
2010-12-13 17:02 1314Oracle/PLSQL: Rank Function: ht ... -
Oracle Analytic Functions:RANK, DENSE_RANK, FIRST and LAST
2010-12-13 17:02 1258Oracle/PLSQL: Rank Function: ht ... -
Oracle:Collections Records Type %TYPE %ROWTYPE
2010-11-09 22:27 1264PL/SQL Collections and Records: ... -
Oracle Cursor 游标
2010-11-09 20:44 3041Oracle中Cursor介绍: http://www.ite ... -
Oracle 锁机制
2010-09-19 20:12 3721Oracle多粒度封锁机制研究: http://www.itp ... -
Oracle Data Dictionary 数据字典
2010-09-19 16:44 1533Oracle数据字典查阅: http://download.o ... -
Oracle Sign Function
2010-09-17 14:52 1461Oracle/PLSQL: Sign Function: ht ... -
Oracle Built-In Functions: Next_Day and Last_Day
2010-09-16 17:09 1533next_day(date,char): 它用来返回从第一个 ... -
Oracle Procedure 存储过程
2010-09-16 08:36 1359Oracle/PLSQL: Creating Procedur ... -
Oracle Exception Handle 异常处理
2010-09-15 13:00 2084Handling PL/SQL Errors: http:// ... -
Oracle 性能工具 : Explain plan、Autotrace、Tkprof
2010-09-14 18:07 2226Oracle: 三个内置的性能工具包 Explain plan ... -
关于Oracle数据和对象的导入导出 [转]
2010-09-14 10:25 1262关于Oracle数据和对象的导入导出 [转]: http:// ... -
Oracle jobs(DBMS_JOB and DBMS_SCHEDULER)
2010-07-21 14:14 7795写PL/SQL procedure的时候,一定要写的够健壮、够 ... -
Oracle 各种注释
2010-07-20 14:19 3643为SQL语句添加注释: http://do ... -
Oracle 监听 本地Net服务名 配置
2010-07-20 10:32 1322Oracle数据库配置: http://shupili1410 ... -
[Oracle]Difference between a database and an instance(数据库 实例 区别)
2010-07-20 09:31 1496Difference between a database a ... -
Oracle Bulk Collect
2010-07-16 10:03 1371On BULK COLLECT: http://www.ora ... -
Oracle/PLSQL: FOR Loop 循环语句
2010-07-15 16:43 9343Oracle/PLSQL: FOR Loop: http:// ...
相关推荐
Oracle常见错误代码 Oracle常见错误代码 以下表格中收集了Oracle中常见错误代码。
下面将对Oracle常见错误的处理方法进行详细探讨。 首先,关于数据库恢复,在文档中特别提到“数据库非常规恢复”的注意事项。文档明确指出,以下内容仅供在非生产环境测试使用,而不能用于生产环境数据库。这强调了...
本篇文章将详细解析部分Oracle常见错误及其原因,帮助你更好地理解和解决这些问题。 1. ORA-00001: 违反唯一约束条件 这个错误表示尝试插入或更新的数据违反了表中的唯一键约束。这意味着有重复的值试图插入到定义...
### Oracle常见错误精集知识点详解 #### 一、Oracle 基础问题及解决方法 ##### 1. ORA-12541: TNS: 没有监听器 **原因**: 当遇到ORA-12541错误时,通常是因为监听器未启动或者监听器存在问题。 **解决方案**: - ...
Oracle常见错误及解决方法Oracle常见错误及解决方法
本文将详细介绍 Oracle 常见错误代码的分析与解决方法,旨在帮助读者快速解决 Oracle 错误问题,提高数据库管理效率。 错误代码 ORA-01650 ORA-01650 错误代码是 Oracle 数据库管理员最常见的错误信息之一,产生...
### Oracle常见错误处理 #### 一、物理与逻辑块损坏 在Oracle数据库中,数据存储在物理块中,这些块可能会出现物理或逻辑损坏。理解这些错误及其处理方法对于维护数据库稳定性和数据完整性至关重要。 ##### 物理...
### ORACLE常见错误代码的分析与解决 在Oracle数据库管理过程中,遇到各种错误代码是不可避免的。本文将针对几个常见的Oracle错误代码进行深入解析,并提供相应的解决方案,帮助数据库管理员及开发人员更好地理解和...
"Oracle 常见错误集(01653、12541、12537)和处理方法" Oracle 是一种广泛使用的关系型数据库管理系统,但是在实际使用中,我们经常会遇到各种错误,影响数据库的正常运行。本文将介绍三个常见的 Oracle 错误:Ora...
### 如何解决Oracle常见错误 ORA-04031 #### 一、与共享池相关的实例参数 在深入探讨如何解决ORA-04031错误之前,我们需要先了解几个与共享池(`shared pool`)密切相关的Oracle实例参数: 1. **`SHARED_POOL_SIZE`...
Oracle常见错误代码的分析与解决,从这里可以看到那些常见的错误并有解决方案
Oracle常见错误代码的分析与解决 Oracle错误代码的分析与解决
以下是一些常见的Oracle错误号及其原因和解决办法: 1. ORA-01002:fetch out of sequence - 当游标没有正确地按照执行顺序进行操作时,比如在未调用`OPEN`、`FETCH`或`CLOSE`之前尝试`FETCH`,会出现这个错误。...
本文将总结一些常见的Oracle错误及其解决方案。 首先,我们来看第一个错误:ORA-28056。这个错误通常发生在审计功能尝试将记录写入Windows事件日志时失败。错误信息“OSD-160222236: Message 160222236 not found; ...
以下是一些常见的Oracle错误及其解释和解决方法: 1. ORA-00001: 违反唯一约束条件 当尝试插入或更新的数据在具有唯一约束(如唯一索引)的列中存在重复值时,会出现此错误。解决方法是检查插入或更新的数据,确保...
本篇文章将详细解析一些Oracle数据库中常见的错误,帮助你更好地理解和解决这些问题,从而更熟练地操作Oracle。 1. ORA-00922: 无法识别的选项 这个错误通常发生在创建或修改表时,可能是因为指定了Oracle不支持的...