Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Can't get Proc Parameter with ODBC from C++
On Wed, 16 Jun 1999 23:59:33 GMT, jashaw1_at_my-deja.com wrote:
>I'm trying to capture an output parameter from an Oracle stored proc
>using C++ and ODBC.
>
>I am trying to return one of the proc parameters (the only one defined
>as an OUT on the Oracle end), not a return code.
>
>Here's a clip of ODBC C++ I've been trying(return codes from debugger
>in parenthesis in comments above statement):
>
>*************************************************
>// Prep SQL statement (returns 0, OK)
>retCode = SQLPrepare(oConnection->hStmt, (SQLCHAR*)"{call myproc1(1,
>'test2', 'test3', 'test4', 'test5', 'test6', 'C', ?)}", SQL_NTS);
>
>// bind to output parameter from stored proc (returns 0, OK)
>retCode = SQLBindParameter(oConnection->hStmt, 1, SQL_PARAM_OUTPUT,
>SQL_C_CHAR, SQL_VARCHAR, 60, 0, pszErrorMessage, 60, &nErrMsg);
>
The second parameter to SQLBindParameter is actually the parameter number that you are binding. In your case, you are trying to bind a character buffer to the literal parameter 1 (?). This would make sense, then, why you are getting SQL_NEED_DATA below, as you really haven't bound any buffer to the parameter marker '?' in your statement.
See what happens if you change the parameter number to 8 (which is the position of the parameter marker '?').
>// Execute proc (this returns 99 = SQL_NEED_DATA, not getting anything
>back)
>retCode = SQLExecute(oConnection->hStmt);
>
>//Try retrieving param with MoreResults (this returns -1 on the first
>pass and loops infin, still not getting anything back)
>while ( ( retCode = SQLMoreResults(oConnection->hStmt) ) != SQL_NO_DATA
>) {
> retCode = retCode; // just a bogus line to monitor loop
> }
>
>*************************************************
>Any Oracle ODBC examples capturing a single value from a stored proc
>would be greatly appreciated.
>Thanks,
>Jeff
>
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Thanks!
Joel
Joel R. Kallman Oracle Service Industries
Columbus, OH http://govt.us.oracle.com jkallman@us.oracle.com http://www.oracle.com
![]() |
![]() |