Calling DB2 stored procedure with output parameter

1,740 views
Skip to first unread message

Hung Tam Nguyen

unread,
Oct 16, 2017, 11:21:30 AM10/16/17
to DB Solo
For a DB2 stored procedure defined as.

CREATE OR REPLACE PROCEDURE A.SP
(
IN  in_variable SMALLINT,
OUT out_variable VARCHAR(9)
)
BEGIN
    CALL A.ANOTHER_SP(in_variable, out_variable);
END


We can run it easily directly on the database server via command line or using other SQL tools like this:
call A.SP(42, ?)


But in DBSolo it doesn't work, the error is:

       [jcc][10143][10845][3.64.114] Invalid parameter 1: Parameter is not set nor registered. ERRORCODE=-4461, SQLSTATE=42815



How can we make DBSolo understand the ? character in SQL editor?     

DB Solo Admin

unread,
Oct 16, 2017, 6:05:48 PM10/16/17
to DB Solo
Hi,

Something like this should work

begin
  DECLARE outParam VARCHAR(9);
  CALL A.SP(5, outParam);
end


marko

Hung Tam Nguyen

unread,
Oct 17, 2017, 10:10:02 AM10/17/17
to DB Solo
yes that works using CTRL+SPACE to execute, but why doesn't it accept the standard one-liner call command?  

Is there any way to maybe escape the ? character in DBsolo and make it work? our devs won't like the idea of having to check the procedure code all the time just redeclare output variables before execution.

DB Solo Admin

unread,
Oct 17, 2017, 8:48:04 PM10/17/17
to DB Solo
Currently there is no way to make it work except the method I posted earlier. I can investigate if support for this could be added somehow.

marko

Hung Tam Nguyen

unread,
Oct 18, 2017, 1:21:35 PM10/18/17
to db-...@googlegroups.com
Thank you, that would be great! Please write back once you have done investigating.


--
You received this message because you are subscribed to a topic in the Google Groups "DB Solo" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/db-solo/4oWckC92F1M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to db-solo+unsubscribe@googlegroups.com.
To post to this group, send email to db-...@googlegroups.com.
Visit this group at https://groups.google.com/group/db-solo.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages