Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> OCIStmtExecute on an update query locks...
Hi gentlemen,
I'm using a piece of code for SQL Statements with OCI. It works fine with a select statement, but the OCIStmtExecute function seems to lock (it does'nt return) on an update statement. I can't figure out the cause of this problem.
Here is the code around the blocking "execute" :
// select query...
CString sz = "select count(*) from road.test";
st = ::OCIStmtPrepare( m_pStmt, m_pErr,
(text*) sz.GetBuffer( 0 ), sz.GetLength(), OCI_NTV_SYNTAX, OCI_DEFAULT );if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) { return false;
// ---> this one is ok
st = ::OCIStmtExecute( m_pService, m_pStmt, m_pErr, 0, 0, NULL, NULL,
OCI_DEFAULT );
if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) {
return false;
}
// update query
sz = "update road.test set col1 = 3";
st = ::OCIStmtPrepare( m_pStmt, m_pErr,
(text*) sz.GetBuffer( 0 ), sz.GetLength(), OCI_NTV_SYNTAX, OCI_DEFAULT );if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) { return false;
// ---> this one never returns....
st = ::OCIStmtExecute( m_pService, m_pStmt, m_pErr, 1, 0, NULL, NULL,
OCI_DEFAULT );
if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) {
return false;
}
I tried with and without an OCIBeginTrans. I also tried reallocating
the statement handle. Nothing works.
Any information will be a great help !
Best regards,
C.
Received on Mon Feb 20 2006 - 03:16:19 CST
![]() |
![]() |