Difficulty: Easy
Correct Answer: ALTER PROCEDURE
Explanation:
Introduction / Context:
Stored procedures can become invalid due to dependency changes (e.g., altered tables or views). Database administrators may need to recompile a procedure to refresh its execution plan or to revalidate dependencies without changing its source code.
Given Data / Assumptions:
Concept / Approach:
The ALTER PROCEDURE statement (in systems that support it) is used to recompile or revalidate an existing procedure. Other options either are vendor-specific utilities (e.g., SQL Server’s sp_recompile invoked via EXEC) or imply replacing the source text (CREATE OR REPLACE), which is not strictly “recompile” without source changes.
Step-by-Step Solution:
Identify action: recompile without altering source.Map to DDL verb: ALTER PROCEDURE ... COMPILE (platforms that support explicit compile).Exclude utilities and create/replace workflows.Select “ALTER PROCEDURE.”
Verification / Alternative check:
Platform docs show ALTER PROCEDURE ... COMPILE (Oracle) as the standard approach to recompile invalid procedures. Other systems may recompile implicitly on first execution or use different mechanisms, but ALTER PROCEDURE captures the generic DDL intent.
Why Other Options Are Wrong:
COMPILE PROCEDURE: not a standard SQL statement.
Common Pitfalls:
Assuming every DBMS uses the same syntax; however, ALTER PROCEDURE (with a compile clause) represents the cross-vendor idea of explicit recompilation.
Final Answer:
ALTER PROCEDURE
Discussion & Comments