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 -> Re: Inserting LONG RAW through ODBC on Oracle 8 causes "Function sequence error"

Re: Inserting LONG RAW through ODBC on Oracle 8 causes "Function sequence error"

From: txm <txm_at_best.com>
Date: Wed, 24 Mar 1999 17:24:55 -0800
Message-ID: <36f99074$0$206@nntp1.ba.best.com>


Thank you for the reply.

I think you used "long varchar". I use "long raw". Anyway I took your suggestion but it did not work. I got "Function sequence error".

Thanks!

txm

Yuri Yusupov <@aci-openpage.com>> wrote in message <7da5m9$87d$1_at_storm.comstar.ru>...
>Hi !
>IMHO, the right sequence is
>SQLPrepare, SQLBindParameter, SQLExecute.
>
>I tried it next way and It works with 32bit and for 16 bit it gives
>[Oracle][ODBC Oracle Driver] [Oracle OCI]ORA-01480: trailing null missing
>from STR bind value
>ODBC State = S1000, Native Error =1480
>
>It happens when I try to put more then ~64K info into LONGVARCHAR
Oracle7.3
>DB through 16bit ODBC.
>Oracle ODBC16bit driver 7.3
>
>
> sprintf( qstr,"Update PAGE_INSTANCE set PAGE_STRUCT = ? where SYSTEM_ID
=
>%ld", sysid );
>
> rc = SQLPrepare( hstmt,(UCHAR*)qstr,SQL_NTS );
>..
> cb_ps = SQL_DATA_AT_EXEC; //
> rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
>SQL_LONGVARCHAR,
>SQL_LEN_DATA_AT_EXEC(0), 0, (void*)4, 0, &cb_ps);
>..
> rc = SQLExecute(hstmt);
>
> PTR pToken;
> while (rc == SQL_NEED_DATA) {
>
> rc = SQLParamData(hstmt, &pToken);
>
> if (rc == SQL_NEED_DATA) {
> for (int i= 0 ; i< repeat; i++) {
> RETCODE r = SQLPutData( hstmt, page_struct, len );
> if ( RETCODE_IS_FAILURE( r )) {
> rc = r;
> break;
> }
> }
> }
> }
>..
> SQLFreeStmt( hstmt,SQL_DROP );
>
>
>txm wrote in message <36f8673e$0$216_at_nntp1.ba.best.com>...
>>Hi all
>>
>>I'm trying to insert long raw and having problems. Since Oracle's ODBC
>>driver's SQLPutData supports only up to 32k (per chunk), I need to repeat
>>SQLPutData. My codes are like:
>>
>>-----------------------------------------
>>#define buflen 70000
>>#define sendlen 10000
>>
>> char* insertStmt = "INSERT INTO blobtest (first) VALUES (?)";
>>
>> SQLINTEGER copied = SQL_LEN_DATA_AT_EXEC(buflen - 1);
>>
>> ret = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_BINARY,
>>SQL_LONGVARBINARY, buflen, 0, (SQLPOINTER) 2, buflen - 1, &copied);
>> ret = SQLExecDirect(hstmt, (PUCHAR)insertStmt, SQL_NTS);
>> SQLPOINTER pToken;
>>
>> SQLPOINTER next = longraw;
>>
>> if (ret == SQL_NEED_DATA)
>> {
>> ret = SQLParamData(hstmt, &pToken);
>> for (int i = 0; i < buflen/sendlen; i++)
>> {
>> ret = SQLPutData(hstmt, next, sendlen);
>> next = (SQLPOINTER) ((DWORD) next + sendlen);
>> }
>> }
>>
>> ret = SQLEndTran(SQL_HANDLE_DBC , hdbc, SQL_COMMIT);
>> ----------------------------------------------
>>
>>When I commit, it gets "Function sequence error". SQLParamData works only
>>once. If I call SQLParamData more than once as ODBC manual says, it gets
>>"Function sequence error", too.
>>
>>I'm stuck now. Does anybody have any idea?
>>
>>Thank you.
>>
>>
>>
>>
>>
>
Received on Wed Mar 24 1999 - 19:24:55 CST

Original text of this message

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