Hi,
If I want to iterate through a bunch of records of a cursor and exit as soon a condition is met, what is the correct syntax for this? For eg, in this case as soon as the condition is met, I would like it to start executing the statements after CLOSE c1 ( not exit from the procedure). Thanks!
CREATE PROCEDURE TEST()
RESULT SETS 0
MODIFIES SQL DATA
NOT DETERMINISTIC
LANGUAGE SQL
BEGIN
DECLARE c1 CURSOR FOR.....
OPEN c1;
FETCH records...
-- check the value of the record.. if condition is met, close cursor, exit and go to OTHER STATEMENTS1 ---
CLOSE c1;
-- OTHER STATEMENTS1 ---
-- OTHER STATEMENTS2 ---
END;