[unixODBC-support] stored procedure with output parameter

Nick Gorham nick.gorham at easysoft.com
Thu May 25 12:14:42 BST 2006

Nagesh Sharvari-A21337 wrote:

>    I am facing problem executing stored procedures which has an out
>parameters. Please tell me what's wrong in my code
>This is how I am using call statement to execute a procedure,
> strcpy(stmt, "call simpleproc(?)") ;
> rc = SQLPrepare(hstmt,stmt,SQL_NTS);   
>and binding an integer parameter, id to the statment :
>rc= SQLBindParameter(hstmt, 1, SQL_PARAM_OUTPUT, SQL_C_LONG,
>SQL_INTEGER, 0, 0, &id, 0, NULL);
>if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO))
>   printf("Error in call to stored procedure %d\n",rc);
>   SQLGetDiagRec(SQL_HANDLE_STMT, hstmt,1, stat,&err,msg,100,&mlen);
>   printf("%s (%d)\n State : %s \n",msg,err, stat);
The code looks fine, I think it will be a issue with the MySQL driver, I 
would ask the MySQL folk.

Nick Gorham
Easysoft Limited
http://www.easysoft.com, http://www.unixODBC.org

More information about the unixODBC-support mailing list