on 2012 Jul 19 10:31 AM
Hi. I use this code to test if a variable exists or not (in this case gnVar)
ALTER TRIGGER ...... declare a tinyint; ...... begin set gnVar=1; set a=1; exception when others then set a=2; end; if a=1 then --gnVar exists else --gnVar doesn't exist end if; ........ end
Is it possible for a to be 1 even if gnVar does not exist (this is the only explanation for some strange data sets)? The code is designed for Sql Anywhere 7 and 9. The problem appeared in Sql Anywhere 9.
Gabriel
The following code works as expected in 7.0.3.2046 and 9.0.2.3951 (the V9 test is shown), so you should look elsewhere for an explanation.
FYI if it actually is a bug in V9, it's not going to get fixed, so version-specific branching to call VAREXISTS() may be the only workaround (VAREXISTS was introduced in 8.0.2).
SELECT @@VERSION; @@VERSION '9.0.2.3951' BEGIN declare a tinyint; begin set gnVar=1; set a=1; exception when others then set a=2; end; SELECT a; end a 2 CREATE VARIABLE gnVar INTEGER; BEGIN declare a tinyint; begin set gnVar=1; set a=1; exception when others then set a=2; end; SELECT a; end a 1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.