iterate

SQL/PL

Go to next iteration of the specified loop

Syntax

iterate_stmt:
          ITERATE  label_name

Description

The ITERATE statement initiates the next iteration of the loop specified by label_name.

Example

create procedure bio_match(in match_str char)
begin
    declare author_name char(30) default null;
    declare author_bio varchar(216) default null;
    declare nfm char(45) default "No author found with short_bio containing:";
    my_for: for author_row as authors cursor for
        select * from author
    do
        if locate(match_str, author_row.short_bio, 1) == 0 then
            iterate my_for;
        end if;
        set author_name = author_row.full_name;
        set author_bio = author_row.short_bio;
        select author_name, author_bio;
    end for my_for;
    if author_name is null then
        select nfm, match_str;
    end if;
end; 

See Also

leave