故障排除错误有两个和

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了故障排除错误有两个和相关的知识,希望对你有一定的参考价值。

enter image description here

我有一个表,这将被用于供应商记分卡,十个一个不同领域的可分配1-5的值。允许空值。

我需要编写一个查询,将计算由每行填写领域的平均水平。换句话说,我可能会在一排地将总11,而在另一除以总5。

我与此查询工作:

select 
cf$_vendor_no, 
cf$_party,  
cf$_environmental, 
cf$_inspections, 
cf$_invoice_process, 
cf$_ncr, 
cf$_on_time_delivery, 
cf$_qms, 
cf$_safety, 
cf$_schedule, 
cf$_scope_of_work, 
cf$_turn_times,
sum(nvl(cf$_environmental,0)
+nvl(cf$_inspections,0)
+nvl(cf$_invoice_process,0)
+nvl(cf$_ncr,0)
+nvl(cf$_on_time_delivery,0)
+nvl(cf$_qms,0)
+nvl(cf$_safety,0)
+nvl(cf$_schedule,0)
+nvl(cf$_scope_of_work,0)
+nvl(cf$_turn_times,0)) 
/
sum(
case when cf$_environmental is not null then 1 else 0 end +
case when cf$_inspections is not null then 1 else 0 end +
case when cf$_invoice_process is not null then 1 else 0 end +
case when cf$_ncr is not null then 1 else 0 end +
case when cf$_on_time_delivery is not null then 1 else 0 end +
case when cf$_qms is not null then 1 else 0 end +
case when cf$_safety is not null then 1 else 0 end +
case when cf$_schedule is not null then 1 else 0 end +
case when cf$_scope_of_work is not null then 1 else 0 end +
case when cf$_turn_times is not null then 1 else 0 end) --as "average"
from supplier_scorecard_clv  
group by cf$_vendor_no, cf$_party, cf$_environmental, cf$_inspections, cf$_invoice_process, cf$_ncr, cf$_on_time_delivery, cf$_qms, cf$_safety, cf$_schedule, cf$_scope_of_work, cf$_turn_times

而且,它几乎工作。

在我的代码的第一SUM将每一行中添加值给我一个总。我得到用于第一FARW002行共25个,我得到6用于第二,和12为第三。

在我的代码的第二SUM工作为好。我得到的6计数我的第一个FARW002行,2我的第二个,和3我的第三个。

然而,当我尝试这些,结合如上面的代码片段,我得到一个“ORA-00923:FROM关键字未找到预期”的错误,我不知道为什么。

答案

所以,这是愚蠢的,但这里的问题是什么结束了福利:

 +nvl(cf$_turn_times,0))  
/ 
sum( 

当我改变了代码,这一点 - 我真的只是dicking左右 - 它的工作:

+nvl(cf$_turn_times,0))/sum(

因此,一些关于具有/和SUM从查询的其余部分分开 - 我只做让代码为我更可读的 - 是造成问题。感谢什么娟!

以上是关于故障排除错误有两个和的主要内容,如果未能解决你的问题,请参考以下文章

对NetBackup 问题进行故障排除的步骤

安全Kerberos相关问题进行故障排除| 常见错误和解决方法

交换机故障排除的方法与步骤

错误消息/故障排除我的代码

Nginx反向代理后端多节点下故障节点的排除思路

如何对事件日志中的 .NET 2.0 错误报告消息进行故障排除?