• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrieve dynamic columns from stored procedure

 
suresh midde
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I was given a procedure which expects one value and retrieves me the list of columns which may vary depending upon the input parameter

CREATE PROCEDURE [FLX].[GETANS]
@ques VARCHAR(200) AS
BEGIN

// some code that creates a temp table which has the dynamic cols
create table #temp1(


SELECT * FROM #temp1
END


When I execute this procedure from db2, it is fetching me the records. I would like to invoke this stored procedure from java. How can I retrieve the output columns of the procedure from java as the columns may vary some times.

Regards
Suresh Midde
 
Santhosh ayiappan
Ranch Hand
Posts: 80
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the index of the column to get the records back. You dont need to depend on the column name.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic