Hola gente!!!
Estoy intentando crear un procedimiento almacenado en MySql. Este procedimiento, realiza un SELECT en cual lleva una claúsula LIMIT, al estilo "0,10".
No obstante, necesito que en lugar del cero, utlizar una variable que recibo como parámetro del procedimiento. Quedaría algo como "pag,10", por ejemplo.
Si en lugar de "pag" utilizo un numero, lo puedo crear perfectamente, pero si intento utilizar la variable, me envia un mensaje de error que dice:
Cita: 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 'pag,10;
END' at line 19
Este es el codigo:
Código:
delimiter //
CREATE PROCEDURE prueba(anyo INT, mes INT, numPag INT)
BEGIN
SELECT
idingreso AS id,
idpagina AS idpag,
identificador AS ident,
ipingreso AS ip,
sesion,
UNIX_TIMESTAMP(fechaingreso) AS time_stamp
FROM
adm_datosingreso
WHERE
YEAR(fechaingreso) = anyo AND
MONTH(fechaingreso) = mes
ORDER BY
idpagina,
fechaingreso
LIMIT
pag,10;
END;
//