Hi....

i'm new for mysql , I want to get max of N records from a table and i want process the N records one by one , so I used one cursor ..


declare cursorname cursor for select x,y from tablename where y='11'
order by x desc limit 4;

if I'm give like this na its working .....

but limit of N is Given by User so I modify like this

declare cursorname cursor for select x,y from tablename where y='11'
order by x desc limit N;

If i'm give like this na it gives error

pls Give Solution


Thanks,