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

asked 09 Dec '22, 09:51

BBuck's gravatar image

BBuck
11113
accept rate: 0%


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.

permanent link

answered 09 Dec '22, 10:08

Volker%20Barth's gravatar image

Volker Barth
39.2k353537806
accept rate: 33%

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?

(09 Dec '22, 10:22) BBuck
Replies hidden

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.

(09 Dec '22, 10:57) Volker Barth

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.

(09 Dec '22, 12:30) BBuck

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?

permanent link

answered 03 Jan, 06:35

ArcoW's gravatar image

ArcoW
718
accept rate: 0%

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...

(03 Jan, 09:24) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×23
×19

question asked: 09 Dec '22, 09:51

question was seen: 120 times

last updated: 03 Jan, 09:26