Is it possible to interrupt the execution of the for loop on pl / sql, if so how? Example:
for rec in (query1) loop check:=sc_user.function(query1.device); if check ='yes' then *прервать цикл* end if; end loop; Is it possible to interrupt the execution of the for loop on pl / sql, if so how? Example:
for rec in (query1) loop check:=sc_user.function(query1.device); if check ='yes' then *прервать цикл* end if; end loop; The most acceptable way to break a loop is exit [label] when <boolean_expression>; . The label is not required, but does not recommend lowering it for better readability. In nested loops, in addition, it will enable you to specify from which loop to exit, and to distinguish variables of the same name.
<<fetch_query1>> for rec in (query1) loop exit fetch_query1 when (sc_user.function(fetch_query1.rec.device) = 'yes'); -- делать что.то с fetch_query1.rec end loop fetch_query1; It is incorrect to exit the cycle by if-then-else . Properly listed @Crystal methods, but the most correct & mdash; exit when . In general, in your case, a cycle with the condition:
for rec in (query1) while not check = 'yes' loop check := sc_user.function(query1.device); end loop; Source: https://ru.stackoverflow.com/questions/76414/
All Articles