错误:ORA-01428:参数' 0'超出范围

时间:2014-04-25 05:39:45

标签: sql oracle

我正在尝试计算SQL中的信息增益。以下是我的表格:

WORD, INSCALE NOTINSCALE D_FREQ book 22 19 41 reserve 14 16 30

查询在这里:

CREATE TABLE FINAL_2INFOGAIN (WORD, INFO_G) AS
SELECT WORD, 
-(17081/33676)*LOG(10,17081/33676)+(D_FREQ/33676)*(INSCALE/D_FREQ)*log(10, INSCALE/D_FREQ)+(NOTINSCALE/33676)*(NOTINSCALE/D_FREQ)*log(10, NOTINSCALE/D_FREQ) AS INFO_G
FROM FINAL_CONTIN2;

它一直给我这个错误:

  

错误:ORA-01428:参数'0'超出范围   01428. 00000 - “参数'%s'超出范围”'。

错误指向log(10, NOTINSCALE/D_FREQ)处的“D_FREQ”。

任何人都可以帮我解决这个问题吗?感谢。

1 个答案:

答案 0 :(得分:1)

使用您的示例数据,这可以按预期工作:

CREATE TABLE FINAL_2INFOGAIN (WORD, INFO_G) AS
WITH final_contin2(word, inscale, notinscale, d_freq) as (
  select 'book', 22, 19, 41 from dual 
  union all
  select 'reserve', 14, 16, 30 from dual
)
SELECT 
  WORD, 
  -(17081/33676)*LOG(10,17081/33676) +
    (D_FREQ/33676)*(INSCALE/D_FREQ)*log(10, INSCALE/D_FREQ) + 
    (NOTINSCALE/33676)*(NOTINSCALE/D_FREQ)*log(10, NOTINSCALE/D_FREQ) AS INFO_G
FROM FINAL_CONTIN2;

您收到的错误消息来自对log的调用 - 真实表中的至少一行FINAL_CONTIN2包含inscale,notinscale和d_freq的值表达式inscale/d_freq resp。 notinscale/d_freq变为0或负数。