当前位置: 代码迷 >> DB2 >> db2创建PROCEDURE成功,但是运行db2 call TESTCASE() 会报错,该怎么解决
  详细解决方案

db2创建PROCEDURE成功,但是运行db2 call TESTCASE() 会报错,该怎么解决

热度:10765   发布时间:2013-02-26 00:00:00.0
db2创建PROCEDURE成功,但是运行db2 call TESTCASE() 会报错
创建PROCEDURE成功,但是运行db2 call TESTCASE() 会报错,哪位大侠知道是什么原因吗
以前是console 里面的显示:
$ db2 -td@ -vf /mnt/hgfs/Win2Ubuntu-2/put_line/put_line_aix/testcase.sqp
CREATE PROCEDURE TESTCASE() RESULT SETS 0 LANGUAGE SQL
L_TESTCASE:
BEGIN NOT ATOMIC 
DECLARE V_DEPTNO SMALLINT;
DECLARE V_DEPTNAME VARCHAR(20);
DECLARE V_DIVISION VARCHAR(20);
-- FOR DEBUG
DECLARE V_NUM SMALLINT DEFAULT 0;
DECLARE V_MSG1 VARCHAR(4000);
DECLARE V_MSG2 VARCHAR(1);
-- END
-- SAMPLE1
SET V_NUM=2000;
SET V_MSG1='debugging start';
VALUES(PUT_LINE(V_NUM,V_MSG1)) INTO V_MSG2;
-- SAMPLE2
VALUES(PUT_LINE(SMALLINT(2),'this is no2')) INTO V_MSG2;
-- SAMPLE3
VALUES(PUT_LINE(3)) INTO V_MSG2;
-- SAMPEL4
VALUES(PUT_LINE('##number4##')) INTO V_MSG2;
-- SAMPLE5
SET V_NUM = 0;
  FOR V_C1_REC AS C1 CURSOR FOR
SELECT DEPTNUMB, DEPTNAME, DIVISION
FROM ORG ORDER BY DEPTNUMB DESC
  DO
  SET V_DEPTNO = v_C1_REC.DEPTNUMB;
SET V_DEPTNAME = v_C1_REC.DEPTNAME;
  SET V_DIVISION = v_C1_REC.DIVISION;
SET V_NUM = V_NUM + 1;
SET V_MSG1 ='DEPTNO=' || CHAR(V_DEPTNO)||','
||'DEPTNAME='||V_DEPTNAME||','
||'DIVISION='||V_DIVISION;
VALUES(PUT_LINE(V_NUM,V_MSG1)) INTO V_MSG2;
  END FOR;
VALUES(PUT_LINE(32000,'end of the program')) INTO V_MSG2;

END L_TESTCASE

DB20000I The SQL command completed successfully.

$ db2 call testcase()
sh: Syntax error: "(" unexpected


------解决方案--------------------------------------------------------
db2 "call testcase()"
------解决方案--------------------------------------------------------
接上你模式名就可以了,例如:db2 call SCHEMA.TESTCASE()
  相关解决方案