Describe a stored procedure in db2luw

by S. Edouard   Last Updated July 12, 2019 19:06 PM

I have two tables:

create table test2 (id integer not null primary key, first_name varchar(100), last_name varchar(100))

create table test3 (id integer not null primary key, home_address varchar(100), work_address varchar(100))

I created a stored procedure which selects some columns from each table:

CREATE PROCEDURE "BLUADMIN"."REST_PROCTEST1_1_0"() LANGUAGE SQL DYNAMIC RESULT SETS 1 BEGIN DECLARE C1 CURSOR WITH RETURN FOR SELECT T2.FIRST_NAME, T2.LAST_NAME, T3.HOME_ADDRESS, T3.WORK_ADDRESS FROM TEST2 T2 INNER JOIN TEST3 T3 ON T2.ID=T3.ID; OPEN C1; END

I wanted to get a description of the result set. I am looking for a similar output as doing a describe on an SQL statement:

db2 => describe SELECT T2.FIRST_NAME, T2.LAST_NAME, T3.HOME_ADDRESS, T3.WORK_ADDRESS FROM BLUADMIN.TEST2 T2 INNER JOIN BLUADMIN.TEST3 T3 ON T2.ID=T3.ID

Column Information

Number of columns: 4

SQL type | Type length | Column name | Name length

449 VARCHAR | 100 | FIRST_NAME | 10

449 VARCHAR | 100 | LAST_NAME | 9

449 VARCHAR | 100 | HOME_ADDRESS | 12

449 VARCHAR | 100 | WORK_ADDRESS | 12

I am using ODBC to communication to the Db2 database. Is there any way for me to obtain that information?



Related Questions


How to point View to a dynamic database

Updated March 16, 2016 08:02 AM


if statement in a query

Updated April 11, 2019 17:06 PM