If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to define a SQLDA output parameter in CREATE PROCEDURE statement?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-24-03, 09:18
bobnorma bobnorma is offline
Registered User
 
Join Date: Oct 2003
Location: Florida
Posts: 15
Unhappy How to define a SQLDA output parameter in CREATE PROCEDURE statement?

using db2 version 8 udb in AIX....

extern "C" SQL_API_RC SQL_API_FN getParamGroups(struct sqlda *, sqlint32 *, char*);
--------------------
It compiled fine (the SP is implemented with C++ and Embedded SQL). But how do I define the data type for it in the CREATE PROCEDURE statement to register the SP with the database? I tried the following:
---------------
CREATE PROCEDURE GET_GROUPS (OUT output_sqlda STRUCT SQLDA, OUT errorCode INTEGER, OUT errorMsg CHAR(32))
DYNAMIC RESULT SETS 1
LANGUAGE C
PARAMETER STYLE GENERAL
NO DBINFO
FENCED NOT THREADSAFE
READS SQL DATA
PROGRAM TYPE SUB
EXTERNAL NAME 'dbaccesssvr!getGroups'@
-----------------
And of course it failed because I made up this data type STRUCT SQLDA, hoping to hit it. I cannot find in the SQL reference on what data type it should be.
Any info about this? Thanks.
Reply With Quote
  #2 (permalink)  
Old 10-24-03, 15:37
bobnorma bobnorma is offline
Registered User
 
Join Date: Oct 2003
Location: Florida
Posts: 15
Re: How to define a SQLDA output parameter in CREATE PROCEDURE statement?

Quote:
Originally posted by bobnorma
using db2 version 8 udb in AIX....

extern "C" SQL_API_RC SQL_API_FN getParamGroups(struct sqlda *, sqlint32 *, char*);
--------------------
It compiled fine (the SP is implemented with C++ and Embedded SQL). But how do I define the data type for it in the CREATE PROCEDURE statement to register the SP with the database? I tried the following:
---------------
CREATE PROCEDURE GET_GROUPS (OUT output_sqlda STRUCT SQLDA, OUT errorCode INTEGER, OUT errorMsg CHAR(32))
DYNAMIC RESULT SETS 1
LANGUAGE C
PARAMETER STYLE GENERAL
NO DBINFO
FENCED NOT THREADSAFE
READS SQL DATA
PROGRAM TYPE SUB
EXTERNAL NAME 'dbaccesssvr!getGroups'@
-----------------
And of course it failed because I made up this data type STRUCT SQLDA, hoping to hit it. I cannot find in the SQL reference on what data type it should be.
Any info about this? Thanks.



I figured it out this morning,

for anyone interested, it turns out that IBM no longer supports DB2DARI except for compatibility with previous versions, but they do still allow you to use it in the PARAMETER STYLE part the the create statement, so the create turns into:

CREATE PROCEDURE GET_GROUPS (OUT param1 CHAR(3), OUT errorCode INTEGER, OUT errorMsg CHAR(32))
DYNAMIC RESULT SETS 1
LANGUAGE C
PARAMETER STYLE DB2DARI
NO DBINFO
FENCED NOT THREADSAFE
READS SQL DATA
PROGRAM TYPE SUB
EXTERNAL NAME 'dbaccesssvr!getGroups'@


and that's it.. but who know how much longer IBM will support DB2DARI, they don't say anything about going away or keeping it....does anyone know ?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On