From the course: Oracle Database 19c: PL/SQL

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Programming constructs: LOOP

Programming constructs: LOOP

- The loop and loop construct is one of the simplest constructs in PL/SQL to make it a procedural language. Looping through a block of code and exiting on a condition somewhere inside the loop. A loop is a set of statements in PL/SQL, starting with the LOOP keyword and ending with the keywords END LOOP. The loop statement is the simplest type of loop in PL/SQL compared to other looping constructs like the for loop and while loop, covered in another lesson. A loop will always execute at least once, whether it runs again, starting at the top of the block inside the loop depends on the logic inside the loop. So you have to have an if statement inside the loop to know when to exit. Here's the loop syntax. Like any PL/SQL block, you can put a label before the beginning of the loop and before the end of the loop and reference it outside the loop. Primarily for documentation purposes. One or more statements will run…

Contents