我正在测试Db2 for z/OS的一些函数,现在当我尝试通过REXX调用存储过程时遇到了麻烦。
下面是创建需要在存储过程中返回的数据类型的代码
CREATE TYPE *******.ARRAY_TESTE AS VARCHAR(186) ARRAY[200];
这是我用来创建存储过程的DDL
CREATE PROCEDURE *******.TESTE_EMP2
(OUT EDLEVELARR MYVARRTYPE,
OUT LASTNAMEARR MYVARRTYPE)
VERSION MEDIAN_V1
LANGUAGE SQL
NOT DETERMINISTIC
READS SQL DATA
CALLED ON NULL INPUT
DYNAMIC RESULT SETS 1
DISABLE DEBUG MODE
PARAMETER CCSID EBCDIC
QUALIFIER *******
PACKAGE OWNER ******
ASUTIME NO LIMIT
COMMIT ON RETURN NO
INHERIT SPECIAL REGISTERS
NODEFER PREPARE
CURRENT DATA NO
DEGREE 1
DYNAMICRULES RUN
WITHOUT EXPLAIN
WITHOUT IMMEDIATE WRITE
ISOLATION LEVEL CS
WITHOUT KEEP DYNAMIC
OPTHINT ''
RELEASE AT COMMIT
REOPT NONE
VALIDATE RUN
ROUNDING DEC_ROUND_HALF_EVEN
DECIMAL(31)
BUSINESS_TIME SENSITIVE NO
SYSTEM_TIME SENSITIVE NO
ARCHIVE SENSITIVE NO
BEGIN
SELECT ARRAY_AGG(VARCHAR(EDLEVEL)), ARRAY_AGG(LASTNAME)
INTO EDLEVELARR, LASTNAMEARR
FROM DSN81110.EMP ;
END `
这就是我用来调用存储过程的REXX
LOCAL_DB2 = ****
ADDRESS DSNREXX
RC = 'SUBCOM DSNREXX'
OUTTRAP TESTE_DATA.
TESTE_DATA2.
IF RC <> 0 THEN DO
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
END
"CONNECT " LOCAL_DB2
IF SQLCODE <> +0 THEN DO
MY_ERROR = 'ERROR CONNECTING TO DB2 ' LOCAL_DB2
END
EXECSQL "CALL *******.TESTE_EMP2(:TESTE_DATA.,:TESTE_DATA2.)"
IF (SQLCODE<>0) THEN
CALL SQL_ERROR
ADDRESS DSNREXX
"DISCONNECT"
S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
EXIT
型
现在我有SQLCODE
-301 THE VALUE OF INPUT VARIABLE OR ARGUMENT NUMBER position-number CANNOT BE USED AS SPECIFIED BECAUSE OF ITS DATA TYPE
1条答案
按热度按时间0mkxixxg1#
该消息是不言自明的。在当前版本中,用户定义的数组数据类型不是REXX调用Db2存储过程所支持的数据类型之一。
请参考documentation page,了解REXX支持的类型和对应的SQL数据类型。