I have following code in a procedure, it works fine in the Sybase ASA 6, but after migrating it to the 12.5 version, it gives error. Here's the basic example of the code: while(@@sqlstatus = 0) begin declare crs_sid dynamic scroll cursor for select s_th from dba.table where s_var in(1,2,3) open crs_sid with hold fetch next crs_sid into @sid while(@@sqlstatus = 0) begin .. fetch next crs_sid into @sid end close crs_sid end Here's the error I get:
asked 10 Sep '13, 04:24 sam Reimer Pods |
AFAIK, cursor names must be unique in current SA releases - I don't know whether that was different in very old days... (BTW, you're not using version 12.5, as that would be an ASE version, right?) Confine this discussion (though it's based on FOR loops - but they do use cursor names, too): Is there any purpose to the FOR for-loop-name and cursor-name fields? There you'll find the definite answer by Ivan, as documented in DCX for the DECLARE CURSOR statement:
answered 10 Sep '13, 05:44 Volker Barth Thanks for the answer. Sorry I meant SQL Anywhere 12.
(10 Sep '13, 06:04)
sam
Ok it seems that the problem was solved only by deallocating the cursor after closing it.
(10 Sep '13, 07:10)
sam
Replies hidden
That seems odd: The SA 12 docs tell:
(10 Sep '13, 08:02)
Volker Barth
|