PRB: No Records Returned from SELECT with FOR UPDATE Against Oracle8 Server (225110)



The information in this article applies to:

  • ActiveX Data Objects (ADO) 2.0
  • ActiveX Data Objects (ADO) 2.01
  • ActiveX Data Objects (ADO) 2.1
  • ActiveX Data Objects (ADO) 2.5
  • ActiveX Data Objects (ADO) 2.6
  • ActiveX Data Objects (ADO) 2.7

This article was previously published under Q225110

SYMPTOMS

The following error occurs when interacting with a recordset from an Oracle 8 server created with a SELECT statement containing the FOR UPDATE clause:
Error ORA-01002, "Fetch out of sequence"

RESOLUTION

To work around this problem, execute the ADO Connection object's BeginTrans method before executing the SELECT statement. Use the CommitTrans method when finished with the recordset.

MORE INFORMATION

The below example will reproduce the behavior described above. Uncomment the BeginTrans and CommitTrans calls to see the workaround.

Note that this behavior occurs with both the OLE DB Provider and the ODBC driver. Also note that the error does not occur when executed against an Oracle 7.3 server.

Steps to Reproduce Behavior

Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset

Set cnn = New ADODB.Connection
cnn.CursorLocation = adUseClient
cnn.Open "DSN=myoracle8dsn;UID=myuid;PWD=mypwd"

Set rst = New ADODB.Recordset
'cnn.BeginTrans
rst.Open "select * from mytable for update", cnn, adOpenDynamic
rst.MoveFirst
'cnn.CommitTrans
				

Modification Type:MajorLast Reviewed:8/23/2001
Keywords:kbDatabase kbDSupport kberrmsg kbOracle kbprb KB225110