PL/SQL Exception

PL/SQL Exception

PL/SQL Interview Questions

PL/SQL Interview Questions and Answers


PL/SQL Loop Statement

The PL/SQL Loop allows you to iterative sequence of statements repeatedly for a specified number of times. It works like any programing language loop works.

PL/SQL Loop Statement Syntax

To iterative sequence of statements repeatedly for a specified number of times, use the following syntax:

Syntax

PL/SQL Loop Statement example with EXIT Statement

The following PL/SQL uses LOOP with EXIT statement to iterative sequence of statements repeatedly for a specified number of times:

Example

Let's understand how it works:

  • First, we initialize the counter to 100.
  • Second, in each iteration, we increasing counter with 1.
  • Third, we display the result of the counter.
  • Fourth, The loop is terminated when the counter reaches to 50.