How to pass VARGRAPHIC to Stored procedures in DB2?

202 Views Asked by At

How can I call a sp with VARGRAPHIC variable type as input? I've create this super simple sp that dose nothing and just for test, with following statement:

CREATE PROCEDURE MYPROCEDURE (IN VARNAME vargraphic(5) )
LANGUAGE SQL
P1: BEGIN

END P1

but when I call the sp in IBM Data Studio,it raises this error:

{? = call SCHEMA.MYPROCEDURE (?)}
[SQL0189] Coded Character Set Identifier 37 not valid.
Run of routine failed.
 - Roll back completed successfully.

is there any problem in my sp code? should I define CCSIDs? How and where?

1

There are 1 best solutions below

0
Paul Vernon On

I suspect that you would want to specify the CCSID of your parameter like this

call SCHEMA.MYPROCEDURE( CAST(? AS VARGRAPHIC(5) CCSID 65535) )

picking the correct CCSID number as appropriate

https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_74/db2/rbafzcast.htm