Bird
0
0

Consider this PL/pgSQL snippet:

medium📝 query result Q5 of 15
PostgreSQL - PL/pgSQL Fundamentals
Consider this PL/pgSQL snippet:
DECLARE
  total integer := 10;
BEGIN
  total := total * 2;
  RAISE NOTICE '%', total;
END;

What will be printed?
A10
BError
C20
D0
Step-by-Step Solution
Solution:
  1. Step 1: Initial value of total

    total is initialized to 10.
  2. Step 2: Multiply total by 2 and assign

    total becomes 10 * 2 = 20, then printed.
  3. Final Answer:

    20 -> Option C
  4. Quick Check:

    Correct calculation output = B [OK]
Quick Trick: Assignment updates variable value immediately [OK]
Common Mistakes:
  • Ignoring multiplication effect
  • Expecting original value to print
  • Syntax errors in assignment

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes