MySQL error 1318: Incorrect number of arguments
A stored procedure or function was called with more or fewer arguments than it declares. MySQL routines have no optional parameters.
- Error number
1318- Name
ER_SP_WRONG_NO_OF_ARGS- SQLSTATE
42000- Category
- Syntax and statements
What it means
The message tells you what was expected and what you passed. Unlike some databases, MySQL stored routines can't have default values, so every parameter must be supplied, including OUT and INOUT ones, which need a variable.
Common causes
- Leaving out a parameter, expecting a default.
- Not passing a variable for an
OUTparameter. - The routine's definition changed and callers weren't updated.
How to fix it
-
Check the routine's parameters.
SHOW CREATE PROCEDURE shop.place_order;
-
Pass every parameter, using a user variable for
OUTparameters.CALL place_order(42, 3, @order_id); SELECT @order_id;
Related errors
More syntax and statements errors
1064You have an error in your SQL syntax1149SQL syntax error1052Column is ambiguous1055Expression isn't in GROUP BY1093Can't specify target table for update1136Column count doesn't match value count1242Subquery returns more than 1 row1248Every derived table must have its own alias
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.