Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Location
    Florida
    Posts
    15

    Unhappy Unanswered: 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.

  2. #2
    Join Date
    Oct 2003
    Location
    Florida
    Posts
    15

    Re: How to define a SQLDA output parameter in CREATE PROCEDURE statement?

    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 ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •