---
slug: /drop-functionl
---

# DROP FUNCTION

The `DROP FUNCTION` statement is used to delete a stored function.

The syntax for the `DROP FUNCTION` statement is as follows:

```sql
DROP FUNCTION [IF EXISTS] sp_name
```

To drop a stored routine, the user must have the `ALTER ROUTINE` privilege.

Using the `IF EXISTS` clause prevents an error from occurring if the stored function does not exist and generates a warning, which can be viewed using `SHOW WARNINGS`.

Here is an example of the `DROP FUNCTION` statement:

```sql
DROP FUNCTION IF EXISTS my_func;
Query OK, 0 rows affected
```