I want to set the limit of shown result from 0 until the value of declared variable. But I found the error when declaring the variable, it said : "#1064 - you have an error in your SQL syntax.". I know that DECLARE syntax only permitted in the BEGIN ... END statement. But why I always get an error?
This is what I've try :
BEGIN
DECLARE panjang INT DEFAULT 0
END;
SET panjang := 10;
SELECT * FROM `TABLENAME`
limit 0, panjang
Can you please tell me what is missing here? I'm using mysql version 5.5.34.