Multiple choice technology databases

There are ______ types of loops in PL/SQL

  1. 1

  2. 3

  3. 2

  4. 4

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

PL/SQL has three basic loop types: the basic LOOP (with EXIT WHEN), the WHILE loop, and the FOR loop. These provide different iteration patterns for procedural programming within the database.

AI explanation

To answer this question, you need to have knowledge of the types of loops in PL/SQL. Let's go through each option to understand why it is correct or incorrect:

Option A) 1 - This option is incorrect because there are more than one type of loop in PL/SQL. Option B) 3 - This option is correct because there are indeed three types of loops in PL/SQL. Option C) 2 - This option is incorrect because there are more than two types of loops in PL/SQL. Option D) 4 - This option is incorrect because there are not four types of loops in PL/SQL.

The correct answer is B. There are three types of loops in PL/SQL, which are:

  1. FOR loop: This loop is used to iterate over a specific range of values or a collection.
  2. WHILE loop: This loop is used to repeatedly execute a set of statements as long as a certain condition is true.
  3. LOOP-EXIT loop: This loop is used to perform an infinite loop until an exit condition is met using the EXIT statement.

Therefore, the correct answer is B) 3.