如何使用 rexx 获取数组作为输出



我正在测试 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 

该消息是不言自明的。在当前版本中,用户定义的数组数据类型不是 REXX 调用 Db2 存储过程支持的数据类型之一。

请参阅此文档页面,查看 REXX 支持的类型和相应的 SQL 数据类型,

相关内容

  • 没有找到相关文章

最新更新