QuestionQ18

VerifiedPL/SQL Language Fundamentals

Examine this table in the SH schema:

Question Image

User SH executes this code:

Question Image

The program must end with a user-defined message and display no rows if more than one product has a price of 1000.

With which option must ---placeholder be replaced?

Explanation

A scalar SELECT ... INTO that returns more than one row raises the predefined TOO_MANY_ROWS exception, and execution transfers to the exception handler instead of continuing to the normal product-name output. The handler in option A prints the custom “More than one row found” message, while the normal v_pdt_name output is skipped. SQL%ROWCOUNT cannot detect this condition reliably because it is 1 after a multi-row scalar SELECT INTO failure.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!