on 2013 Dec 09 4:26 AM
SQL Anywhere Network Server Version 12.0.1.3967
I use the example from the documentation on CREATE VARIABLE statement:
"This example creates a variable named v1 and sets its value to 10, regardless of whether or not the v1 variable already exists.
CREATE OR REPLACE VARIABLE v1 INT = 10;"
1)
create procedure "dba"."CREATE_VARIABLE_statement"()
begin
CREATE OR REPLACE VARIABLE v1 INT = 10;
end
;
call CREATE_VARIABLE_statement();
select v1;
Result = NULL
But:
2a)
create procedure "dba"."CREATE_VARIABLE_statement"()
begin
execute immediate 'CREATE OR REPLACE VARIABLE v1 INT = 10';
end
;
call CREATE_VARIABLE_statement();
select v1;
Result = 10
2b)
create procedure "dba"."CREATE_VARIABLE_statement"()
begin
CREATE OR REPLACE VARIABLE v1 INT;
set v1 = 10;
end
;
call CREATE_VARIABLE_statement();
select v1;
Result = 10
Request clarification before answering.
This appears to be a bug. I have reproduced it on both the latest v12 and v16. I had a quick look a the code and it seems correct... so there is obviously something strange going on that will require more investigation.
Until this issue is fixed you can use 2b as a work-around.
(I'll post back here when the issue is fixed)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
33 | |
22 | |
17 | |
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.