Bird
0
0

Which of the following PostgreSQL function snippets correctly returns multiple rows using RETURN NEXT?

easy📝 Syntax Q3 of 15
PostgreSQL - PL/pgSQL Fundamentals
Which of the following PostgreSQL function snippets correctly returns multiple rows using RETURN NEXT?
ABEGIN RETURN 1; RETURN 2; RETURN; END;
BBEGIN RETURN NEXT 1; RETURN NEXT 2; RETURN; END;
CBEGIN RETURN NEXT 1, 2; RETURN; END;
DBEGIN RETURN 1, 2; RETURN; END;
Step-by-Step Solution
Solution:
  1. Step 1: Understand RETURN NEXT usage

    RETURN NEXT adds a single row to the result set.
  2. Step 2: Check each snippet

    BEGIN RETURN NEXT 1; RETURN NEXT 2; RETURN; END; uses RETURN NEXT twice to add two rows, then RETURN to finish.
  3. Final Answer:

    BEGIN RETURN NEXT 1; RETURN NEXT 2; RETURN; END; correctly returns multiple rows.
  4. Quick Check:

    Multiple RETURN NEXT calls add rows sequentially [OK]
Quick Trick: Use RETURN NEXT for each row, then RETURN to end [OK]
Common Mistakes:
  • Using RETURN to return multiple rows at once
  • Trying to return multiple rows in one RETURN NEXT
  • Omitting the final RETURN statement

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes