MySQL Forums
Forum List  »  Stored Procedures

Stored Procedure and Variables for Limit
Posted by: Jan Wehmeyer
Date: May 24, 2011 01:11AM

Hello,

ich need this SP to work with MySQL 5.0.x. There are now variables allowed for the limit command. I haven't understood the examples I found for a workaround.

Here the SP:
#All Daily Values with Limitation
DELIMITER //
DROP PROCEDURE IF EXISTS GetAllDailyValues//

CREATE PROCEDURE GetAllDailyValues(
IN id INT,
IN indexStart INT,
IN indexLength INT,
)

BEGIN
DECLARE limitStart INT;
DECLARE limitLength INT;
SET limitStart = indexStart;
SET limitLength = indexLength;

SELECT count*
FROM tblstatistik_daily
WHERE usID = id
ORDER BY stDatum DESC
LIMIT limitStart,limitLength;

END //
DELIMITER ;

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored Procedure and Variables for Limit
3494
May 24, 2011 01:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.