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.

New features of PL/SQL loop constructs

New features of PL/SQL loop constructs - Oracle Database Tutorial

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

New features of PL/SQL loop constructs

- In previous versions of Oracle Database, the for loop options were similar to any other programming language, but had very few options for how you could specify the beginning and ending range of the loop variable. In summary, all you could do was specify a beginning and ending integer value and optionally iterate the loop variable in reverse. This made coding specific scenarios contrived, awkward, and not always straightforward. For example, on the left, I want to display all the odd numbers between one and 10. Using the calculation it works, but it's not clear what I'm looking for. I'll go ahead and run it. Those are all the odd numbers between one and 10. Now, I can use the by clause within the for loop to specify a custom increment, much more efficient, and it's a lot clearer what the range is and how I'm stepping through that range. I'll go ahead and highlight it. Same result. There were other restrictions on…

Contents