on 2022 Dec 09 9:51 AM
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](Func
2 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.Shaper
1.SimpleEnumerator.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable
1 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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.