Archive for 2008

Tegan and Sara – I know I know I know

Two cats eating

Two cats eating

Drinking cat

Drinking cat

Sweet dreams

Sweet dreams

We are sinking!

I think there’s a spy among us

I think there's a spy among us

MySQL: passing limits as stored procedure parameters

Unfortunately MySQL 5 (at least 5.0.15) does not allow using variables or procedure parameters with LIMIT.

Here is a workaround where SQL statement is generated inside stored procedure:

CREATE PROCEDURE GetList (limitStart INT, limitCount INT)
BEGIN
 
SET @SQL = CONCAT('SELECT ID, Name FROM `User`
LIMIT ', limitStart, ', ', limitCount);
 
PREPARE query FROM @SQL;
EXECURE query;
DEALLOCATE PREPARE query;
 
END;

IKEA job interview

Business hours

« Previous Page