Bird
0
0

Given the procedure below, what will be the output when calling CALL ShowMessage();?

medium📝 query result Q4 of 15
SQL - Stored Procedures and Functions
Given the procedure below, what will be the output when calling CALL ShowMessage();?
CREATE PROCEDURE ShowMessage()
BEGIN
  SELECT 'Hello, World!' AS Greeting;
END;
ANo output, procedure does nothing
BAn error because procedures cannot return SELECT results
CA message printed to console but no result set
DA result set with column Greeting and value 'Hello, World!'
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the procedure body

    The procedure runs a SELECT statement that returns a string labeled as Greeting.
  2. Step 2: Understand procedure output

    Calling the procedure executes the SELECT and returns a result set with one row and one column Greeting containing 'Hello, World!'.
  3. Final Answer:

    A result set with column Greeting and value 'Hello, World!' -> Option D
  4. Quick Check:

    Procedure SELECT returns result set = A result set with column Greeting and value 'Hello, World!' [OK]
Quick Trick: SELECT inside procedure returns result set when called [OK]
Common Mistakes:
  • Thinking procedures cannot return SELECT results
  • Expecting console print instead of result set

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes