Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Oracle Stored procedures with ODBC

Oracle Stored procedures with ODBC

From: Matt Innes <madeye_at_easynet.co.uk>
Date: Tue, 05 Jan 1999 14:32:30 +0000
Message-ID: <3692227E.56B1709B@easynet.co.uk>


I am experiencing problems using Oracle stored procedures with ODBC (Oracle v8.0.3.0,
ODBC Driver v8.0.3.0.0, O/S WinNT Wks 4.0 SP3 on server & client).

I have a stored procedure with an output parameter of type VARCHAR2. I wish to call this procedure via ODBC, with the result being stored in a char array in C++. I bind the parameter in ODBC with SQLBindParameter(). The last parameter to the bind call is the StrLen_or_IndPtr (according to the documentation). For this, I pass a pointer to an automatic variable, which initially contains the width of the char buffer (this is the only value that seems to work, using 0 or SQL_NTS or such like gives me an ODBC error "Unable to ascertain cause of error"). With the buffer width as the initial value, the correct data is placed in the buffer, but the buffer is padded out with rubbish. This was placed here by the ODBC driver, as the buffer was zeroed previously. This would be fine, if the actual length of the data were placed in the StrLen_or_IndPtr pointer (it is not, the value remains the same after calling SQLExecute()). I have tested the stored procedure in isolation and it works fine.

Has anyone encountered this problem? Does anyone know how I can retrieve the length of the data in a simple and elegant manner ? I would like to avoid using a direct SELECT statement in this instance.

Thanks,
Matt.

Matt Innes, Tektronix Lightworks Products matt.innes_at_tek.com
+44 171 4626271 Received on Tue Jan 05 1999 - 08:32:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US