Bird
0
0

What will be the output when executing this DO block?

medium📝 query result Q4 of 15
PostgreSQL - PL/pgSQL Fundamentals
What will be the output when executing this DO block?
DO $$
BEGIN
  RAISE NOTICE 'Total: %', 10 * 2;
END
$$ LANGUAGE plpgsql;
ANo output
BERROR: syntax error near '*'
CNOTICE: Total: % 10 * 2
DNOTICE: Total: 20
Step-by-Step Solution
Solution:
  1. Step 1: Understand RAISE NOTICE

    The RAISE NOTICE statement outputs a message to the client with formatted placeholders.
  2. Step 2: Evaluate the expression

    10 * 2 evaluates to 20, so the message will be 'Total: 20'.
  3. Step 3: Confirm syntax

    The syntax is correct with LANGUAGE plpgsql specified.
  4. Final Answer:

    NOTICE: Total: 20 -> Option D
  5. Quick Check:

    RAISE NOTICE formats output with % placeholders [OK]
Quick Trick: RAISE NOTICE outputs formatted messages [OK]
Common Mistakes:
  • Misunderstanding % as literal character
  • Expecting no output from RAISE NOTICE
  • Forgetting to specify LANGUAGE plpgsql

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes