PL/SQL raises an exception, in which TWO of the following cases:

  1. When a SELECT statement returns no rows

  2. When a SELECT statement returns more than one row

  3. When the datatypes of SELECT clause and INTO clause do not match

  4. When INTO statement is missing in the SELECT statement


Correct Option: A,B

AI Explanation

To answer this question, we need to understand when PL/SQL raises an exception.

Option A) When a SELECT statement returns no rows - This option is correct. PL/SQL raises an exception called "NO_DATA_FOUND" when a SELECT statement returns no rows. This exception can be handled using an exception block.

Option B) When a SELECT statement returns more than one row - This option is correct. PL/SQL raises an exception called "TOO_MANY_ROWS" when a SELECT statement returns more than one row. This exception can also be handled using an exception block.

Option C) When the datatypes of SELECT clause and INTO clause do not match - This option is incorrect. PL/SQL does not raise an exception for datatype mismatch between the SELECT and INTO clauses. Instead, it will raise a compilation error during the compilation phase if the datatypes do not match.

Option D) When INTO statement is missing in the SELECT statement - This option is incorrect. PL/SQL does not raise an exception when the INTO statement is missing in a SELECT statement. Instead, it will raise a compilation error during the compilation phase.

The correct answer is A, B. These options are correct because PL/SQL raises exceptions when a SELECT statement returns no rows (NO_DATA_FOUND) or returns more than one row (TOO_MANY_ROWS).

Find more quizzes: