ORA-30454: summary contains STDDEV without corresponding SUM & COUNT

文档解释

ORA-30454: summary contains STDDEV without corresponding SUM & COUNT

Cause: Incremental refresh of summaries with STDDEV(X) requires COUNT(X) and SUM(X) columns to be included in the summary definition

Action: Make sure that the required columns are part of the summary definition if incremental refresh capability is desired.

ORA-30454错误表明用户试图执行一个包含了汇总函数STDDEV的查询,而不存在汇总函数SUM及COUNT,从而导致这个错误。

官方解释

当组内查询(group by queries)中包含STDDEV聚合函数,而不包含聚合函数SUM及COUNT:ORA-30454:summary contains STDDEV without corresponding SUM & COUNT

常见案例

在ORACLE中,使用STDDEV函数计算同一组个数的标准偏差时,多数情况下都需要汇总函数SUM及COUNT,如果缺失其中任何一个函数,即会报ORA-30454:summary contains STDDEV without corresponding SUM & COUNT的错误。

比如:

select stdDev (sal)

from emp

group by deptno;

一般处理方法及步骤

正确处理ORA-30454:summary contains STDDEV without corresponding SUM & COUNT错误的方法是在组内查询中同时使用汇总函数SUM及COUNT。

比如:

select sum(sal), count(sal), stdDev (sal)

from emp

group by deptno;

你可能感兴趣的