1586
MySQLERRORCommonStored RoutinesHIGH confidence

Wrong parameters to stored function

Production Risk

Low — the query fails; no data is modified.

What this means

Arguments of the wrong type were passed to a stored function.

Why it happens
  1. 1Calling a stored function with arguments that do not match the declared parameter types.
How to reproduce
trigger — this will error
trigger — this will error
-- Given: CREATE FUNCTION add_nums(a INT, b INT) RETURNS INT ...
SELECT add_nums('foo', 'bar');

expected output

ERROR 1586 (HY000): Wrong parameters to stored function

Fix

Verify parameter types match the stored function signature

Verify parameter types match the stored function signature
SELECT add_nums(1, 2); -- pass integers as expected

Why this works

Check the stored function definition with SHOW CREATE FUNCTION and ensure argument types match.

Sources
Official documentation ↗

MySQL 8.0 — 1586 ER_WRONG_PARAMETERS_TO_STORED_FCT

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

← All MySQL errors