if your_condition then
   ...
   else
   exit;
end if;或:loop
exit when your_condition;
......;
   end loop;