Hi,
Code:
....
DECLARE done INT DEFAULT 0;
DECLARE s VARCHAR(100) DEFAULT '';
#first query
DECLARE reader CURSOR FOR
SELECT id, title FROM products ;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
OPEN reader
REPEAT
FETCH reader INTO vId, vTitle;
SET s = CONTACT(s, done, ':') ;
#second query
SELECT someother, details FROM another_table WHERE id=someid;
SET s = CONTACT(s, done) ;
UNTIL done
END REPEAT;
I've 10 records in products table so i want to iterate this loop 10 times. But when there is no item found in second query( another_table) loop exits. When i select the var s, i get the result
0:1.
That means When there is no result in SECOND query the DECLARE HANDLER NOT FOUND will execute.
Actually I dont want to stop the loop if there is no result in second query, I want to stop only if there is
no more items in first query.
How to do that, please help me.
thanks to all..