java - Unable to pass array to a Stored Procedure in DB2 - SQL PL - Windows -
i unable call stored procedure has input parameter integer array.
the stored procedure declaration follows
create or replace procedure testschema.testarray (in checkstatus integer, in jobid intarray)
the array declared this
create type intarray integer array[]@
when try call procedure using
call testschema.testarray( 1 , array[21,22,23] )@
i following error -
an unexpected token "array[" found following "array[". expected tokens may include: "".. sqlcode=-104, sqlstate=42601, driver=3.63.123 sql code: -104, sql state: 42601'
i cannot seem find other way this? can please this?
also need find way pass array in java later.
sql pl arrays can used in sql pl context. you'll need declare variable of intarray
type , call procedure, using variable, compound sql statement:
db2inst1@blusrv:~> db2 "create type intarray integer array[]" db20000i sql command completed successfully. db2inst1@blusrv:~> db2 "create or replace procedure testarray(in checkstatus integer, in jobid intarray) begin call dbms_output.put_line('testarray'); end" db20000i sql command completed successfully. db2inst1@blusrv:~> db2 set serveroutput on db20000i set serveroutput command completed successfully. db2inst1@blusrv:~> db2 "begin declare v intarray; set v = array[21,22,23]; call testarray(1,v); end" db20000i sql command completed successfully. testarray
Comments
Post a Comment