Why the stored procedure can't be created?
delimiter //
CREATE PROCEDURE p()
BEGIN
DECLARE j INT;
SET j = 1;
SELECT j:=j+1, request.* FROM request;
END//
The problem is in line:
SET j:=j+1, ...
Why the stored procedure can't be created?
delimiter //
CREATE PROCEDURE p()
BEGIN
DECLARE j INT;
SET j = 1;
SELECT j:=j+1, request.* FROM request;
END//
The problem is in line:
SET j:=j+1, ...
You need to add a @ to the variable name:
delimiter //
CREATE PROCEDURE p()
BEGIN
SET @j = 1;
SELECT @j:=@j+1, request.* FROM request;
END//
Here's an explanation: MySQL: @variable vs. variable. Whats the difference?