OCI UPDATE QUERY

From: Alex <azp74_at_hotmail.com>
Date: 12 Jun 2002 06:41:39 -0700
Message-ID: <dca1064b.0206120541.59dfdfb4_at_posting.google.com>


Hi

I am writing an app in OCI 8 and am having trouble executing the following query:

      update table1 set sec = 4 where sec = 2; where table1 is just (prim integer, sec integer) and prim is its primary key.

My code looks like:

      input2 = 4;
      input3 = 2;

      OCIStmtPrepare(stmtHandle, errorHandle, stmt,

(ub4)strlen((char*)"update table1 set sec = :sec where sec = :sec"),
OCI_NTV_SYNTAX, OCI_DEFAULT);         OCIBindByName(stmtHandle, &bindHandle, errorHandle,
(text*)":sec", -1, &input2, (sword)sizeof(input2), SQLT_INT, 0, 0, 0,
0, 0, OCI_DEFAULT);       OCIBindByName(stmtHandle, &bindHandle, errorHandle,
(text*)":sec", -1, &input3, (sword)sizeof(input3), SQLT_INT, 0, 0, 0,
0, 0, OCI_DEFAULT);       OCIStmtExecute(servContextHandle, stmtHandle, errorHandle,
(ub4)1, (ub4)0, (CONST OCISnapshot*)NULL, (OCISnapshot*)NULL,
OCI_DEFAULT); After returning from OCIStmtExecute I call OCIAttrGet with OCI_ATTR_ROW_COUNT and it tells me that one row has been affected by my execute (which would be correct). However, the change is not reflected in the database. I also put in a call to OCITransCommit with no luck.

I think there must be something straightforward that I am missing as I can quite happily execute other update statements (eg where clause on primary key, or on a bigger table with where clause on columns that are not the one to be updated etc).

TIA
Alex Received on Wed Jun 12 2002 - 15:41:39 CEST

Original text of this message