Bird
0
0

You have this procedure:

medium📝 Debug Q14 of 15
SQL - Stored Procedures and Functions
You have this procedure:
CREATE PROCEDURE update_value(INOUT val INT)
BEGIN
SET val = val + 1;
END;

Which of the following calls will correctly update the session variable @x from 10 to 11?
ACALL update_value(@x);
BCALL update_value(10);
CCALL update_value(INOUT @x);
DCALL update_value(IN @x);
Step-by-Step Solution
Solution:
  1. Step 1: Understand INOUT parameter usage

    INOUT parameters require a variable to pass in and receive updated value. Session variables like @x can be used.
  2. Step 2: Analyze each call

    CALL update_value(@x); passes @x correctly. CALL update_value(10); passes a literal 10, which is not a variable. CALL update_value(INOUT @x); uses invalid syntax. CALL update_value(IN @x); uses IN keyword, which is incorrect for INOUT.
  3. Final Answer:

    CALL update_value(@x); -> Option A
  4. Quick Check:

    INOUT needs variable, not literal [OK]
Quick Trick: Use session variables for INOUT parameters [OK]
Common Mistakes:
  • Passing literals instead of variables
  • Using IN or INOUT keywords in CALL
  • Expecting procedure to update literals

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes