SQLCODE:-420,SQLSTATE:22018,SQLERRMC:BIGINT

时间:2011-05-16 21:50:22

标签: db2

[运行DB2 UDB版本9]为什么这个SQL语句有效

SELECT 
       CASE
       WHEN A.DAILYDOWNLOADSIZE is null THEN 0
    else bigint(A.DAILYDOWNLOADSIZE)
       END "DAILYDOWNLOADSIZE",
       CASE
       WHEN A.DAILYDOWNLOADTIME is null THEN 0
    else bigint(A.DAILYDOWNLOADTIME)
       END "DAILYDOWNLOADTIME"
FROM 
EDMPROD.MQT_STB_FACTS A 

......当这个没有

SELECT DISTINCT 
bigint(A.CAMID) AS "CAMID",
bigint(A.RID) AS "RID",
A.SOFTWAREVERSION,
A.MODELNUMBER,
A.MANUFACTURERID,
A.MODDATE,
A.POSTTIME,
A.DELIVERYMETHOD,
bigint(A.UPTIME )  AS "UPTIME",
bigint(A.NUMBEROFRESETSSINCELASTSWDL )  AS "NUMBEROFRESETSSINCELASTSWDL",
bigint(A.NUMBEROFSEARCHSIGNALOSDTUNER1 ) AS "NUMBEROFSEARCHSIGNALOSDTUNER1",
bigint(A.NUMBEROFSEARCHSIGNALOSDTUNER2 ) AS "NUMBEROFSEARCHSIGNALOSDTUNER2",
bigint(A.NUMBEROFUSERDISKREFORMATS ) AS "NUMBEROFUSERDISKREFORMATS",
bigint(A.NUMBEROFSYSTEMDISKREFORMATS ) AS "NUMBEROFSYSTEMDISKREFORMATS",
bigint(A.NUMBEROFRECOVEREDDISKERRORS ) AS "NUMBEROFRECOVEREDDISKERRORS",
IPINFO,
       CASE
       WHEN A.DAILYDOWNLOADSIZE is null THEN 0
    else bigint(A.DAILYDOWNLOADSIZE)
       END "DAILYDOWNLOADSIZE",
       CASE
       WHEN A.DAILYDOWNLOADTIME is null THEN 0
    else bigint(A.DAILYDOWNLOADTIME)
       END "DAILYDOWNLOADTIME",
bigint(A.TOTALNUMBEROFDOWNLOADSSTARTED ) AS "TOTALNUMBEROFDOWNLOADSSTARTED",
bigint(A.TOTALNUMOFCOMPLETEDDLS ) AS "TOTALNUMOFCOMPLETEDDLS",
CURRENT_DATE AS "LOAD_DATE"
FROM 
EDMPROD.MQT_STB_FACTS A 

我收到错误 SQL0420N在字符串参数中找到无效字符 功能“BIGINT”。 SQLSTATE = 22018 即可。

通过对查询进行疑难解答,我确认罪犯是两列DAILYDOWNLOADSIZE和DAILYDOWNLOADTIME。两者都必须从字符(15)转换为bigint。

第二个SQL语句不起作用???

1 个答案:

答案 0 :(得分:1)

我对此失去了理智,所以我在我的临时表(EDMPROD.MQT_STB_FACTS)中做了一个简单的更改。

我没有将列作为字符键入然后将它们作为bigint转换,而是删除并重新创建了我的表,数据类型设置为BIGINT(8)。

我从我的SQL语句中删除了铸件,错误消失了。

去图..........