
Signature
Knut Stolze
Information Integration
IBM Germany / University of Jena
> Could you please describe what you want to do with that?
I'm trying to get a row of data using a stored procedure, which
returns a SQLDA struct, so the client can get the column names and
their corresponding values. I know I can return a result set from a
stored procedure and use a CLI client to receive the result set. But
that requires the explicit binding of columns to get each value from
each column. If I use SQLDA, I don't need to change the client app
when I add or drop a column from a table. I'm now stuck on this issue,
because the parameter data types in CREATE PROCEDURE declaration do
not seem to have anything for SQLDA, then why they let you define a
stored procedure that returns a SQLDA struct? Please help. Thanks.
W Gemini - 27 Sep 2003 03:46 GMT
>>Could you please describe what you want to do with that?
>
[quoted text clipped - 8 lines]
> not seem to have anything for SQLDA, then why they let you define a
> stored procedure that returns a SQLDA struct? Please help. Thanks.
They did not let you define a stored procedure that returns a SQLDA
structure. You wrote a C function, not a stored procedure. And as the
CREATE PROCEDURE statement showed you, you can't define a stored
procedure that returns a SQLDA structure. I am not sure why you want to
return the SQLDA as your client app doesn't need to change a thing if
you do it correctly with a resultset. Best way is probably through JDBC,
that way the client app doesn't need to change even if you decide to
connect to a different data source.
minjie - 29 Sep 2003 16:36 GMT
W Gemini <wgemini@nowhere.com> wrote in message
> They did not let you define a stored procedure that returns a SQLDA
> structure. You wrote a C function, not a stored procedure. And as the
[quoted text clipped - 4 lines]
> that way the client app doesn't need to change even if you decide to
> connect to a different data source.
Thanks! I did not find the right functions to do what I want before.
Since you said '... as your client app doesn't need to change a thing
if you do it correctly with a resultset', I looked more carefully
through CLI reference and found that I can use SQLNumResultCols(),
SQLDescribeCol(), SQLColAttribute() to do SELECT with unkown number of
columns. In that case I do not need to use SQLDA.
Sean McKeough - 29 Sep 2003 13:43 GMT
One comment...you don't need the DA to protect you from changes to the
table altering your result set data...just explicitly list the columns
you want returned on the mrsp cursor open in the SP. Parm style dari
(which others have mentioned) is bad for many reasons (including
performance in v8)...I would strongly suggest not using it.
I'm not a CLI whiz, but would expect there's some describe like function
you could call on the result set (I know for certain that cursor names,
types etc are returned to the client along with the row data).
>>Could you please describe what you want to do with that?
>
[quoted text clipped - 8 lines]
> not seem to have anything for SQLDA, then why they let you define a
> stored procedure that returns a SQLDA struct? Please help. Thanks.
Knut Stolze - 29 Sep 2003 14:09 GMT
> One comment...you don't need the DA to protect you from changes to the
> table altering your result set data...just explicitly list the columns
[quoted text clipped - 5 lines]
> you could call on the result set (I know for certain that cursor names,
> types etc are returned to the client along with the row data).
You have the SQLGetMoreResults(), SQLNextResult(). The CLI reference
describes how those functions wark and how to use SQLNumResultCols(),
SQLDescribeCol(), SQLColAttribute(), and other functions with the different
result sets.

Signature
Knut Stolze
Information Integration
IBM Germany / University of Jena
minjie - 30 Sep 2003 19:03 GMT
> You have the SQLGetMoreResults(), SQLNextResult(). The CLI reference
> describes how those functions wark and how to use SQLNumResultCols(),
> SQLDescribeCol(), SQLColAttribute(), and other functions with the different
> result sets.
They are precisely what I need. Thanks!