引起:com.ibm.db2.jcc.am.SqlSyntaxErrorException:DB2 SQL错误:SQLCODE = -440,SQLSTATE = 42884

时间:2014-07-07 14:52:24

标签: ibm-mobilefirst adapter ibm-data-studio

从Worklight SQLAdapter

调用IBM DB2中编写的存储过程时,我遇到了以下错误

程序的调用结果:来自Worklight Server的'track_ReqByMob_No':

{
   "errors": [
      "Runtime: Failed to retrieve data with procedure : track_ReqByMob_No"
   ],
   "info": [
   ],
   "isSuccessful": false,
   "warnings": [
   ]
}

控制台输出

[ERROR   ] FWLSE0099E: An error occurred while invoking procedure  [project Raoming_Advisor]SQLAdapter/StoredProcedureFWLSE0100E:  parameters: [project Raoming_Advisor]


Failed to retrieve data with procedure : track_ReqByMob_No

FWLSE0101E: Caused by:  [project Raoming_Advisor]com.ibm.db2.jcc.am.SqlSyntaxErrorException:

DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=TRACK_REQBYMOB_NO;PROCEDURE,

DRIVER=3.66.46java.lang.RuntimeException: Failed to retrieve data with procedure : track_ReqByMob_No

我在DB2中的存储过程(TRAVEL是我的模式名称,trouble_ticket是我的表名

CREATE PROCEDURE track_ReqByMob_No (IN MOB_NO BIGINT )
DYNAMIC RESULT SETS 1

P1: BEGIN

DECLARE cursor2 CURSOR WITH RETURN for

SELECT TRAVEL ."trouble_ticket"."id", TRAVEL."trouble_ticket"."query_trouble_ticket",TRAVEL."trouble_ticket"."status_trouble_ticket"    FROM TRAVEL."trouble_ticket" WHERE TRAVEL."trouble_ticket"."Mob_No"=MOB_NO;

        OPEN cursor2;
END P1 

我的SQLadapter调用函数

function  track_ReqByMob_No(Mob_No){
    return WL.Server.invokeSQLStoredProcedure({
        procedure : "track_ReqByMob_No",
        parameters : [Mob_No]
    });
}

1 个答案:

答案 0 :(得分:2)

在调用函数中使用的模式名称,例如我的模式名称是TRAVEL,所以在我的SQLadapter调用函数

而不是 * procedure:“track_ReqByMob_No”*

我会写 *程序:“TRAVEL.track_ReqByMob_No”*

----------我的UPADTED SQLadapter调用函数----------

function  track_ReqByMob_No(Mob_No){
    return WL.Server.invokeSQLStoredProcedure({
        procedure : "TRAVEL.track_ReqByMob_No",
        parameters : [Mob_No]
    });
}