cancel
Showing results for 
Search instead for 
Did you mean: 

No Current Row of Cursor Error

0 Kudos
841

Hello, we have a few databases that are receiving what seems like intermittent "No Current Row of Cursor" errors. Here is the application exception:

No current row of cursor Message: No current row of cursor StackTrace: at Sap.Data.SQLAnywhere.SAException.CheckException(Int32 idEx) at Sap.Data.SQLAnywhere.SADataReader.FetchValue(Int32 ordinal, DotNetType dotNetType, Boolean throwExIfDBNull, Boolean isGetValue) at Sap.Data.SQLAnywhere.SADataReader.GetValue(Int32 ordinal) at System.Data.Entity.Core.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader1.GetValue(DbDataReader reader, Int32 ordinal) at lambda_method(Closure , Shaper ) at System.Data.Entity.Core.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet) at lambda_method(Closure , Shaper ) at System.Data.Entity.Core.Common.Internal.Materialization.Coordinator1.ReadNextElement(Shaper shaper) at System.Data.Entity.Core.Common.Internal.Materialization.Shaper1.SimpleEnumerator.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToListTSource at MemoController.SaveMemo(String userId) *End Exception*

I enabled SQL logging, here is a portion of that that captures the error:

=,<,52,PREFETCH,65555 =,>,52 =,<,52,GETDATA,65555 =,E,52,-197,No current row of cursor =,>,52 +8,<,52,GETDATA,65555 =,E,52,-197,No current row of cursor =,>,52 +2,<,52,GETDATA,65555 =,E,52,-197,No current row of cursor =,>,52 =,<,52,CLOSE,65555

Any help would be appreciated. We are running on SA 17.0.11.6800. Sap.Data.SQLAnywhere.EF6.dll - 17.0.6.27574 Sap.Data.SQLAnywhere.v4.5.dll - 17.0.6.27574

Billy

Accepted Solutions (0)

Answers (2)

Answers (2)

awitter
Participant
0 Kudos

Be careful with memo (long nvarchar) fields, for these operate a little different. I think you are getting an EOF and this still tries to fetch that last (non existing) record. For it's at the EOF the normal fetch doesn't reply anything, but since it has memo fields, these will still try to fetch, ignoring the EOF flag. Try this without any (n)varchar fields.

Also, do you have the exact sql-request that triggered this error?

VolkerBarth
Contributor
0 Kudos

Are you relating to the MaxLength connection parameter?

If fetching long data (which usually requires SQLGetData calls) would fail, I would suspect another error message...

VolkerBarth
Contributor
0 Kudos

I guess the error description does tell it all for SQLCODLE -197 (SQLE_NO_CURRENT_ROW):

Probable cause
You attempted to perform an operation on the current row of a cursor, but the cursor is not positioned on a row. The cursor is before the first row of the cursor, after the last row, or is on a row that has since been deleted.

0 Kudos

Yes, thank you. This is intermittent so its not like its happening every time. Do you have any ideas as to what could cause this?

VolkerBarth
Contributor
0 Kudos

Well, I can't tell whether your code might try to access rows before the first or after the last row. If this intermitent, I would suspect you are trying to access deleted rows. For this topics like concurrent access, isolation levels and cursor sensitivity seem relevant. I.e. if your cursor computes its rowset's membership during opening (say, via a value-sensitive cursor), further fetches might try to read a row that has been deleted by a different transaction in between, and this will issue this error.

The V17 docs do show thes differences here.

0 Kudos

Let me add a little more information. There are several environments that are experiencing this issue, however, the vast majority are not. It does seem that we were able to clear up this issue in one environment by performing an unload/reload of the database. However, we don't know WHY this fixes the issue. Because of this, it seems to be database related but we don't have much to go on, other than the error that was previously posted. We can reproduce this issue consistently in one of the environments but not sure where to look next.