dbTalk Databases Forums  

Cursor not in a valid state?

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Cursor not in a valid state? in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Robert Paresi
 
Posts: n/a

Default Cursor not in a valid state? - 09-15-2009 , 12:33 PM






Hi,

I am using the latest V11 database and I get the following error message:

"Cursor not in a valid state"

What does that mean???


SELECT
PREFIX+' '+FIRSTNAME+' '+LASTNAME AS Line1,
COMPANY AS Line2,
STREET AS Line3,
CITY + ', ' + STATE + ' ' + ZIPCODE AS Line4,
COUNTRY AS Line5,gtd_number
FROM HISTHD
WHERE CITY <> ' ' AND STATE <> ' ' AND ZIPCODE <> ' '
and HISTHD.GTD_NUMBER <> '' and substr(HISTHD.GTD_NUMBER,1,1) <>
ascii(128)

Reply With Quote
  #2  
Old   
Robert Paresi
 
Posts: n/a

Default Re: Cursor not in a valid state? - 09-15-2009 , 12:35 PM






Hi,

If I change the query to this --- I don't get the message:

SELECT
PREFIX+' '+FIRSTNAME+' '+LASTNAME AS Line1,
COMPANY AS Line2,
STREET AS Line3,
CITY + ', ' + STATE + ' ' + ZIPCODE AS Line4,
COUNTRY AS Line5,gtd_number
FROM HISTHD
WHERE CITY <> ' ' AND STATE <> ' ' AND ZIPCODE <> ' '
and HISTHD.GTD_NUMBER <> '' and ascii(substr(histhd.gtd_number,1,1)) <>
128

Reply With Quote
  #3  
Old   
Glenn Paulley [Sybase iAnywhere]
 
Posts: n/a

Default Re: Cursor not in a valid state? - 09-15-2009 , 01:29 PM



This error would be returned if, after the cursor/SELECT has already
encountered an error (for example, a data exception), the
application/interface attempts to reposition the cursor using an
absolute or relative fetch.

My guess is that the SELECT caused a data exception. The domain of the
ASCII function is CHAR and its domain is INTEGER; ASCII(128) is 49
(convert the integer 128 to a string ('128'), return the ascii value of
the first character ('1') which is 49. Unlikely what you want.

Since ASCII returns an int, the mixed-type comparison

substr(HISTHD.GTD_NUMBER,1,1) <> ascii(128)

will take place in a NUMERIC domain - and if any GTD_NUMBER begins with
any non-numeric character, a data exception will occur.

Glenn


Robert Paresi wrote:
Quote:
Hi,

I am using the latest V11 database and I get the following error message:

"Cursor not in a valid state"

What does that mean???


SELECT
PREFIX+' '+FIRSTNAME+' '+LASTNAME AS Line1,
COMPANY AS Line2,
STREET AS Line3,
CITY + ', ' + STATE + ' ' + ZIPCODE AS Line4,
COUNTRY AS Line5,gtd_number
FROM HISTHD
WHERE CITY <> ' ' AND STATE <> ' ' AND ZIPCODE <> ' '
and HISTHD.GTD_NUMBER <> '' and substr(HISTHD.GTD_NUMBER,1,1)
ascii(128)
--
Glenn Paulley
Director, Engineering (Query Processing)
Sybase iAnywhere

Blog: http://iablog.sybase.com/paulley

EBF's and Patches: http://downloads.sybase.com
choose SQL Anywhere Studio >> change 'time frame' to all

To Submit Bug Reports: http://case-express.sybase.com

SQL Anywhere Studio Supported Platforms and Support Status
http://my.sybase.com/detail?id=1002288

Whitepapers, TechDocs, and bug fixes are all available through the
Sybase iAnywhere pages at
http://www.sybase.com/products/datab...chnicalsupport

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.