I usually work with MS-SQL 2000/2005, so I might be doing something really stupid here, but the syntax for declaring a variable (within a Stored Procedure) seems pretty simple, based on
http://dev.mysql.com/doc/refman/5.0/en/declare.html.
The code I'm trying in a Script Tab in MySQL Query Browser is:
Code:
DELIMITER $$
BEGIN
DECLARE x INT;
SET x = 5;
SELECT x;
END$$
DELIMITER ;
When I execute that, I get the following error:
Quote:
You have an error in your SQL syntax: check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE x INT;
SET x = 5;
SELECT x;
END' at line 2
|
This is on a MySQL 5.1 server, but I've also tried it on another 5.0 server with the same error (and the docs link up top is for 5.0)