Hello Albert 

> -----Original Message-----
> From: Beermann, Albert [mailto:[EMAIL PROTECTED] 
> Sent: Mittwoch, 16. November 2005 09:12
> To: maxdb@lists.mysql.com
> Subject: Problem with variable returned from dbproc
> 
> Hello Everybody
> 
> I work with odbc and a maxdb 7.5 database
> 
[details snipped]

> From SQL-Studio everything works as expected:
> call dbproc_autonum('CUSTOMERS',:neuerwert) with commit
> shows  out(1)
>        471118  = the next id 
> 
> In my application i do
> l_cmd = "call dbproc_autonum('CUSTOMERS',:neuerwert) with commit"
> =sqlexec(p_verbindungsnr,l_cmd)
> no error
> 
> But what is the name of the returned variable in my 
> application ???????

Use SQLBindParameter ([SQL_PARAM_INPUT_OUTPUT|SQL_PARAM_OUTPUT]):

Example: ODBC and following dbproc:

create dbproc test_proc (IN a int, INOUT b int, OUT s int) AS set s = a+b; set 
b=4;


/* no error checking! */

    sprintf( stmtStr, "{ CALL test_proc (?,?,?) }" );
    retcode = SQLPrepare( hstmt, stmtStr, SQL_NTS );

    retcode = SQLBindParameter( hstmt, 1, SQL_PARAM_INPUT,
                                SQL_C_LONG, SQL_INTEGER, 72, 0,
                                &a, sizeof(a), &len );

    retcode = SQLBindParameter( hstmt, 2, SQL_PARAM_INPUT_OUTPUT,
                                SQL_C_LONG, SQL_INTEGER, 72, 0,
                                &b, sizeof(b), &len );

    retcode = SQLBindParameter( hstmt, 3, SQL_PARAM_OUTPUT,
                                SQL_C_LONG, SQL_INTEGER, 72, 0,
                                &s, sizeof(s), &len );

    a = 2;

    retcode = SQLExecute( hstmt );

Now, b and s are changed according the dbproc.



HTH  Thomas




----------------------------------------------
Dr. Thomas Kötter
SAP AG, Berlin
NW DT MaxDB

MaxDB: all you need!                   
www.mysql.com/products/maxdb  www.sapdb.org  

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to