The example in this article describes the Oracle stored procedure looping syntax. Share to everyone for your reference, specific as follows:
1. Simple cycle
Grammar
loop
statements;
End Loop;
Example:
Counter: = 0;
Loop
Counter: = counter + 1;
Exit when counter = 5;
End Loop;
Note: The exit statement ends the loop immediately, and the exit when statement stops the loop when the specified condition appears (you can appear anywhere in the Loop code)
2, while loop
Grammar
While condition loop
statements end
Loop;
Example:
Counter: = 0;
While counter < 6 loop
Counter: = counter + 1;
End Loop;
3, for Loop
Grammar
For loop_variable in [reverse] lower_bound ... Upper_bounder Loop
statements end
Loop;
Example:
For Count2 in 1..5 loop
dbms_output. Put_Line (count2);
End Loop;
I hope this article will help you with your Oracle database program design.