I try to write a simple procedure in phpmyadmin and I need to declare variables..
CREATE PROCEDURE FARMER()
IN nume VARCHAR(50)
BEGIN
DECLARE playerid NUMBER(6);
DECLARE suma NUMBER(3);
DECLARE newsum NUMBER(3);
DECLARE bonus NUMBER(3);
SELECT FLOOR(RAND()*(20-1)+1) INTO bonus;
SELECT ID into playerid from player where nume = USERNAME;
SELECT GOLD into suma from wallet where playerid = ID;
newsum := suma + bonus;
END
Is there any way to use DECLARE
without problems. I am not importing the procedure, I am writing it in SQL tab... I've read some things about using DELIMITER
but I tried it and it didn't work.