Running this through my SQL utility yields an error
Code:
DECLARE xname VARCHAR(5) DEFAULT 'bob';
DECLARE newname VARCHAR(5);
DECLARE xid INT;
" You have an error in your SQL syntax; chekc the manual that corresponds to your MySQL server version for the right syntax to use"
...but I got the syntax from this example in the manual:
Code:
CREATE PROCEDURE sp1 (x VARCHAR(5))
BEGIN
DECLARE xname VARCHAR(5) DEFAULT 'bob';
DECLARE newname VARCHAR(5);
DECLARE xid INT;
SELECT xname,id INTO newname,xid
FROM table1 WHERE xname = xname;
SELECT newname;
END;
So my question is, can variables not be defined in scripts, or do I need a different syntax for multi-statement operations?