Bird
0
0

Identify the syntax error in this PL/pgSQL block:

medium📝 Debug Q6 of 15
PostgreSQL - Advanced PL/pgSQL
Identify the syntax error in this PL/pgSQL block:
DO $$
DECLARE
  total INTEGER := 100
BEGIN
  RAISE NOTICE 'Total: %', total;
END;
$$ LANGUAGE plpgsql;
AMissing semicolon after variable declaration.
BIncorrect RAISE NOTICE syntax.
CMissing LANGUAGE specification.
DBEGIN block should be before DECLARE.
Step-by-Step Solution
Solution:
  1. Step 1: Check variable declaration

    Each statement in DECLARE must end with a semicolon.
  2. Step 2: Identify missing semicolon

    The line 'total INTEGER := 100' lacks a terminating semicolon.
  3. Final Answer:

    Missing semicolon after variable declaration. -> Option A
  4. Quick Check:

    Every declaration line ends with semicolon [OK]
Quick Trick: End declarations with semicolon [OK]
Common Mistakes:
  • Forgetting semicolon after declarations
  • Misplacing BEGIN and DECLARE blocks
  • Incorrect RAISE NOTICE syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes