Unix Technical Forum

MySQL 5 SP question: can I use parameter in LIMIT clause?

This is a discussion on MySQL 5 SP question: can I use parameter in LIMIT clause? within the MySQL General forum forums, part of the MySQL category; --> I want to write a sp return paging of recordset. CREATE PROCEDURE `sp_GetJobsDetails`(Page INT, PageSize INT) BEGIN DECLARE RecordBegin ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 09:30 PM
Jason Chan
 
Posts: n/a
Default MySQL 5 SP question: can I use parameter in LIMIT clause?

I want to write a sp return paging of recordset.

CREATE PROCEDURE `sp_GetJobsDetails`(Page INT, PageSize INT)
BEGIN
DECLARE RecordBegin INT;
DECLARE tmpPageSize INT;
SET RecordBegin = Page * PageSize - PageSize;
SET tmpPageSize = PageSize + 1;

SELECT JOB_ID
FROM JOB
LIMIT RecordBegin, tmpPageSize; <- this line cause error, does it
supported?

END



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com