on 2013 Sep 10 5:24 AM
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:
Item crs_sid already exists.
Request clarification before answering.
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:
When a single statement is processed, all of the DECLARE CURSOR statements must use distinct names (even if the cursors are declared in scopes that do not overlap). [...]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That seems odd: The SA 12 docs tell:
DEALLOCATE statement
This statement has no effect in SQL Anywhere, and is ignored. It is provided for compatibility with Adaptive Server Enterprise and Microsoft SQL Server. Refer to your Adaptive Server Enterprise or Microsoft SQL Server documentation for more information about this statement.
User | Count |
---|---|
76 | |
30 | |
8 | |
8 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.