Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle 8 and ODBC truncation problems
Hi mira,
I believe this is an Oracle limitation. You ODBC driver is probably calling Oracle's obndrn() or obndrv() to perform the binding. You need to rebind (as you do in the second example) to make it work.
To quote from Oracle's documentation:
"However, if you need to change the type or length
of the variable, you must reparse and rebind
before re-executing."
Unfortunately, this is all happening under the covers, which makes it very difficult to understand. :-(
HTH,
candi
In article <3676f630.26601260_at_news.earthlink.net>,
mira_at_primus.com wrote:
> I have a C++ ODBC program which replicates a (Versant) database into
> an Access database for reporting purposes. The program should also
> work with an other ODBC database, so I've been testing it with Oracle
> 8 on NT. I'm having trouble with SQLBindParameter when the SQLExecute
> is inside a loop. Oracle (or the drivers?) seems to be ignoring the
> final parameter which is SQL_NTS. Instead of copying the whole
> string, it only copies part of it. If I redo the SQLBindParameter
> call, it works - but I don't think I should have to do that.
>
> This code only works the first time. Subsequent groupNames are
> truncated to the length of th first groupName.
> cbgroup=SQL_NTS;
> SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
> SQL_CHAR,(GROUPNAME_LEN),0, groupName, 0, &cbgroup);
>
> while (++GroupData) {
> groupName = GroupData().GroupName();
> rc = SQLExecute(hstmt);
> }
>
> This code works every time.
>
> cbgroup=SQL_NTS;
> while (++GroupData) {
>
> groupName = GroupData().GroupName();
> SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
> SQL_CHAR,(GROUPNAME_LEN),0, groupName, 0, &cbgroup);
> rc = SQLExecute(hstmt);
> }
>
> Any ideas would be appreciated.
>
> Mira Lieberman
> mira_at_primus.com
>
>
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu Dec 17 1998 - 13:54:34 CST