Hi all,
could anyone please tell me how to declare and use variables in DB2 UDB 8.2?
I did it in SQL Server and Oracle without any problems:
DECLARE @my_var FLOAT
SET @my_var = -0.33;
SELECT * from TEST WHERE t*@my_var >= 12.0; (for SQL Server)
or
DEFINE my_var = -0.33;
SELECT * from TEST WHERE t*&my_var >=12.0; (for Oracle)
Is there such a possibility also for DB2? I just found out that a
declaration of variables is possible with
DECLARE my_var float;
SET my_var = -0.33;
But then SELECT * from TEST WHERE t*my_var >= 12.0;
gives me error SQL0206N during execution in the so called "Befehlseditor"
How could I use the declared variable? With $, : or @ in front of my_var it
also doesn't work.
Thanks in advance for good ideas!
Cheers,
Ina