SQL object management: Which SQL statement removes (deletes) a stored function from the database catalog so it can no longer be invoked?

Difficulty: Easy

Correct Answer: DROP FUNCTION

Explanation:


Introduction / Context:
Managing database objects includes cleanly removing ones that are obsolete. SQL uses the verb DROP to delete schema objects from the catalog. Knowing the correct statement prevents orphaned references and deployment issues.


Given Data / Assumptions:

  • The object is a stored function.
  • We need a DDL command that removes it from the schema.
  • We assume mainstream SQL syntax.


Concept / Approach:
The SQL verb for removing objects is DROP. For functions, the form is DROP FUNCTION function_name ( [signature] ) in many systems. “DELETE” is a DML verb for rows, not objects; “REMOVE/ERASE FUNCTION” are not standard SQL commands.


Step-by-Step Solution:
Identify object class: FUNCTION.Apply the DROP verb to remove it from the catalog.Select DROP FUNCTION as the exact command.


Verification / Alternative check:
DBMS documentation shows DROP FUNCTION used across vendors (PostgreSQL, MySQL, SQL Server with DROP FUNCTION syntax, Oracle uses DROP FUNCTION as part of PL/SQL object management).


Why Other Options Are Wrong:

  • DELETE FUNCTION / REMOVE FUNCTION / ERASE FUNCTION: Not standard SQL DDL.
  • None of the above: Incorrect because DROP FUNCTION is correct.


Common Pitfalls:
Forgetting to check dependencies; some systems require CASCADE or will error if dependent objects exist.


Final Answer:
DROP FUNCTION

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion