This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-21. For the latest, interactive version please visit https://mariadb.com/kb/.

Error 1305: does not exist

Error CodeSQLSTATEErrorDescription
130542000ER_SP_DOES_NOT_EXIST%s %s does not exist

Possible Causes and Solutions

This error is returned when what is being called called does not exist. 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:

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)
CALL reset_animal_count();
ERROR 1305 (42000): PROCEDURE test.Reset_animal_count does not exist

CALL Reset_animal_count();
Query OK, 0 rows affected (0.001 sec)
  • The database specified is not the same as the 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, 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)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.