Arrays in DB2 Stored Procedure
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Database

#1: Arrays in DB2 Stored Procedure Author: ed.sam13 PostPosted: Wed Oct 21, 2015 7:01 pm
    —
Can stored procedures created for DB2 on z/OS support arrays? I tried the example in https://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.apdv.sqlpl.doc/doc/c0052894.html but doesnt work.

This is my Native SP. Create Type doesnt throw an error but the usage of INTARRAY in the input or as other DECLARE variable type is throwing an error.

Code:
--#SET TERMINATOR #
DROP   PROCEDURE SYSPROC.MY_PROCEDURE #
CREATE TYPE intArray AS INTEGER ARRAY[100] #
CREATE PROCEDURE SYSPROC.MY_PROCEDURE
(
--INPUT VARIABLES
IN   IN_IDS                          intArray,

#2:  Author: William Collins PostPosted: Thu Oct 22, 2015 1:23 am
    —
Unless you can find something in a DB2 for z/OS manual, the for the DB2 version you are using, it won't work in DB2 for z/OS.

#3:  Author: Mickeyd PostPosted: Thu Oct 22, 2015 8:49 am
    —
the mainframe will not THROW errors or anything else.

#4: Re: Arrays in DB2 Stored Procedure Author: kolusuLocation: San Jose PostPosted: Thu Oct 22, 2015 11:40 am
    —
ed.sam13 wrote:
Can stored procedures created for DB2 on z/OS support arrays? I tried the example in https://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.apdv.sqlpl.doc/doc/c0052894.html but doesnt work.

This is my Native SP. Create Type doesnt throw an error but the usage of INTARRAY in the input or as other DECLARE variable type is throwing an error.


ed.sam13,

You need to use Multi row fetch with occurs on z/OS. Define a cursor and fetch the data into host variables defined as occurs.

Example can be seen here

https://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/sqlp/rbafymultifetch1.htm



MVSFORUMS.com -> Database


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group