Integer in MySQL Subqueries in store procedure

Posted by confiq on Stack Overflow See other posts from Stack Overflow or by confiq
Published on 2010-05-07T13:36:50Z Indexed on 2010/05/07 13:58 UTC
Read the original article Hit count: 544

I made simple procedure just to demonstrate

 CREATE PROCEDURE `demo`(demo_int int)
BEGIN
    DECLARE minid INT;
    SELECT min(id) FROM (SELECT id FROM events LIMIT demo_int,9999999999999999) as hoo INTO minid;
END$$

The problem is with demo_int, if i change it to

LIMIT 1,9999999999999999

it works but

LIMIT demo_int,9999999999999999

Does not... It gives error

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 'demo_int,9999999999999999) as hoo INTO minid; END' at line 4 (errno: 1064)

Any clues?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysql-query