Multiple choice

For which of the following tasks would it be most appropriate to use a PL/SQL WHILE loop?

  1. To add six new services to the SERVICE table

  2. To change MACHINE_ID 123456 to 456789 and change all others to 900000

  3. To change MACHINE_ID 123456 to 456789

  4. To add new services to the SERVICE table until finished

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

A WHILE loop is used when you need to iterate based on a condition and don't know in advance how many iterations are required. Option D describes 'until finished' which implies conditional iteration based on completion status. The other options (A, B, C) are one-time operations that don't require looping - they can be accomplished with single SQL statements.