1305
MySQLERRORCommonObject Not FoundHIGH confidence

Stored procedure or function does not exist

What this means

ER_SP_DOES_NOT_EXIST (1305) is returned when a CALL or SELECT invokes a stored procedure or function that does not exist in the current database.

How to reproduce
trigger — this will error
trigger — this will error
CALL non_existent_procedure();

expected output

ERROR 1305 (42000): PROCEDURE mydb.non_existent_procedure does not exist

Fix

Check the procedure exists in the correct database

WHEN When the procedure is expected to exist.

Check the procedure exists in the correct database
-- List all procedures in current database:
SHOW PROCEDURE STATUS WHERE Db = DATABASE();

-- Check if it exists with a fully qualified name:
CALL mydb.my_procedure();

Why this works

SHOW PROCEDURE STATUS lists all stored procedures. Always qualify the call with the database name if the current database may differ from where the procedure was created.

What not to do

Create the procedure in the wrong database

The current database at procedure creation time is baked into the routine — creating it without USE mydb will put it in the wrong schema.

Sources
Official documentation ↗

MySQL 8.0 — 1305 ER_SP_DOES_NOT_EXIST

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors