Article
home/blog/Loading

How to drop a function in SQL

Dropping or deleting a function in SQL is useful for many different scenarios. You might need to drop and re-create or you might not need the function anymore

Basic Drop

This is the bare minimun required to drop a function in SQL

DROP FUNCTION function_name;

Better Drop

Adding IF EXISTS allows you to handle a potential error that would be thrown if the function does not exist (perhaps it has already dropped). It is essentially the equivalent -f in rm -f

DROP FUNCTION IF EXISTS function_name;