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: CONTINUE and EXIT

Programming constructs: CONTINUE and EXIT - Oracle Database Tutorial

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

Programming constructs: CONTINUE and EXIT

- [Instructor] A WHILE loop will exit on the condition in the WHILE clause, and FOR loops will exit when the iterator has reached the end. But if you want to alter the sequence of events in any loop, you can use continue and exit. You can also use GOTO, which X similarly to exit. Here are the three types of loops you'll use in PL/SQL. Simple loops with just loop and end loop. FOR loops which iterate over a counter and a WHILE loop that starts and keeps looping depending on the condition specified in the WHILE clause. With a simple loop, you must find another way to exit and I'll show you how that works with the exit statement. You can use continuing exit with any type of loop. Regardless of the type of loop, here are the things you can do in a loop. Run one or more statements in the loop. When you get to the end of the loop, do them all again. Or part way through the loop, you check some kind of condition, and if it's true, start again at the top. You'll use continue for this…

Contents