> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1300-to-1399/e1305.md).

# Error 1305: FUNCTION or PROCEDURE does not exist

| Error Code | SQLSTATE | Error                    | Description          |
| ---------- | -------- | ------------------------ | -------------------- |
| 1305       | 42000    | ER\_SP\_DOES\_NOT\_EXIST | %s %s does not exist |

## Possible Causes and Solutions

This error is returned when the stored procedure, stored function or other object being used doesn't exist. The message names the kind of object, usually `PROCEDURE` or `FUNCTION`, and its full name, including the database. For example:

```
CALL Reset_animal_count();
ERROR 1305 (42000): PROCEDURE test.Reset_animal_count does not exist

SELECT Reset_animal_count();
ERROR 1305 (42000): FUNCTION test.Reset_animal_count does not exist
```

There are a number of possible causes:

* The [stored procedure](/docs/server/server-usage/stored-routines/stored-procedures.md) or [stored function](/docs/server/server-usage/stored-routines/stored-functions.md) has not yet been created. See [CREATE PROCEDURE](/docs/server/server-usage/stored-routines/stored-procedures/create-procedure.md) or [CREATE FUNCTION](/docs/server/reference/sql-statements/data-definition/create/create-function.md). For example:

```
DELIMITER //
CREATE PROCEDURE Reset_animal_count()                      
    MODIFIES SQL DATA
    UPDATE animal_count SET animals = 0;
 //
Query OK, 0 rows affected (0.032 sec)

DELIMITER ;

CALL Reset_animal_count();
Query OK, 0 rows affected (0.001 sec)
```

* There was a typo in the name. Routine names aren't case-sensitive, so `CALL reset_animal_count()` calls `Reset_animal_count`. Database names can be case-sensitive, depending on [lower\_case\_table\_names](/docs/server/server-management/variables-and-modes/server-system-variables.md#lower_case_table_names). See [Identifier Case-sensitivity](/docs/server/reference/sql-structure/sql-language-structure/identifier-case-sensitivity.md).
* A built-in function name was mistyped. The server then looks for a stored function of that name in the current database:

```
SELECT CONCATT('a', 'b');
ERROR 1305 (42000): FUNCTION test.CONCATT does not exist
```

* The database specified is not the same as the database containing the stored procedure or function. For example:

```
use test2
CALL Reset_animal_count();
ERROR 1305 (42000): PROCEDURE test2.Reset_animal_count does not exist
```

Either change the default (current) database with the [USE statement](/docs/server/reference/sql-statements/administrative-sql-statements/use-database.md), or specify the database in the call, for example:

```
CALL test.Reset_animal_count(); 
Query OK, 0 rows affected (0.001 sec)
```

or

```
use test
CALL Reset_animal_count();
Query OK, 0 rows affected (0.001 sec)
```

* One is trying to access a stored procedure instead of a stored function, or vice-versa. For example:

```
SELECT Reset_animal_count();
ERROR 1305 (42000): FUNCTION test.Reset_animal_count does not exist

CALL Reset_animal_count();  
Query OK, 0 rows affected (0.001 sec)
```

* A [SAVEPOINT](/docs/server/reference/sql-statements/transactions/savepoint.md) of that name wasn't set in the current transaction, or was released, when you run `ROLLBACK TO SAVEPOINT` or `RELEASE SAVEPOINT`:

```
ROLLBACK TO SAVEPOINT sp1;
ERROR 1305 (42000): SAVEPOINT sp1 does not exist
```

`DROP PROCEDURE` and `DROP FUNCTION` also return this error for a routine that doesn't exist. With `IF EXISTS`, they return a note with code 1305 instead.

An account without the `EXECUTE` privilege gets [error 1370](/docs/server/reference/error-codes/mariadb-error-codes-1300-to-1399/e1370.md) instead, even when the routine doesn't exist.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
