Saikumar Kataram
Saikumar Kataram

Reputation: 3

How can I see a value returned by a DB2 stored procedure in IBM Data Studio?

I am trying to verify the output value returned by IBM DB2 stored procedure.

How can I see a value returned by a stored procedure in IBM Data Studio.

Upvotes: 0

Views: 5620

Answers (2)

Paul Vernon
Paul Vernon

Reputation: 3911

Do you mean IBM Data Studio? If so there are two ways

  1. Right click on the SP in the Database Explorer and click run

  2. Create global variables for each OUT or INOUT parameter, then examine their value after the call (within the same session/connection)

I.e

CREATE VARIABLE P1 VARCHAR(1024);
CREATE VARIABLE P2 VARCHAR(1024);
CALL SYSIBMADM.DBMS_UTILITY.DB_VERSION(P1,P2);
VALUES (P1, P2);

which will return

 1             2
 ------------- -------------
 DB2 v11.1.3.3 DB2 v11.1.3.3

Upvotes: 1

mao
mao

Reputation: 12297

In IBM Data Studio 4.1.3 client, there's more than one place that you can run stored procedures.

Have you tried using the documentation before asking stackoverflow?

Your question mentions "output value", which could mean either an output parameter or a result-set. Different tabs show these things.

Here is one way:

In the Data perspective, from Data Source Explorer you can navigate to your procedure, right-click it then choose RUN. Enter the input/inout parameter values in the resulting window and when you run it, the lower pane 'SQL Results' has three tabs 'History', 'Status', 'Parameters'. The values of the output parameters appear in the 'Parameter' tab. IF the stored procedure had no parameters then there will be no 'Parameters' tab.

If the stored-procedure has result-sets, then each result-set has its own tab 'Result1' 'Result2' etc, and these tabs don't appear if there are no result-sets.

Upvotes: 0

Related Questions