mariadb-call

Documents MariaDB-specific CALL statement syntax, parameter binding, and result-set semantics.

28|115|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-call-mariadb-corporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mariadb-call
Source: https://github.com/mariadb-corporation/mariadb-docs/tree/main/agent-skills/granular/statements/mariadb-call
Command: npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-call-mariadb-corporation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? LLMs frequently generate incorrect MariaDB CALL statements by assuming mandatory parentheses, passing literals to OUT/INOUT parameters, or conflating procedure result sets with function return values. This Skill provides the MariaDB-specific rules needed to write, generate, or review CALL statements correctly. ## Core Features & Use Cases - Parameter Binding Rules: Explains that OUT and INOUT parameters must bind to user-defined variables (@var) rather than literals, with values read back via SELECT @var. - Result-Set and Privilege Semantics: Clarifies that procedures return result sets directly to the client (unlike stored functions), and that only the EXECUTE privilege on the routine is required. - Recursion and Prepared Statements: Covers max_sp_recursion_depth for recursive procedures and CALL as a prepared statement with placeholders for all parameter modes. - Use Case: When asked to write a stored procedure call that returns a computed total, produce CALL total_orders(@customer_id, @total); followed by SELECT @total; instead of incorrectly passing a literal placeholder. ## Quick Start Ask the AI to write a MariaDB CALL statement for a stored procedure with an OUT parameter and verify the syntax against MariaDB 11.8 behavior.

Frequently Asked Questions about mariadb-call

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I call a stored procedure in MariaDB?▼

Use CALL sp_name(parameters) to invoke a stored procedure in MariaDB. When the procedure takes no arguments, parentheses are optional, so CALL sp_name and CALL sp_name() are equivalent. The name can be schema-qualified as db_name.sp_name.

How to get OUT parameter values from a MariaDB procedure?▼

OUT and INOUT parameters must be bound to user-defined variables like @var, not literals. After the CALL returns, read the value with SELECT @var. If the procedure never assigns the OUT parameter, the variable is set to NULL.

Can a MariaDB stored procedure return result sets?▼

Yes, a stored procedure can return one or more result sets directly to the client, one per top-level SELECT in its body. This differs from stored functions, which only return a scalar via RETURN. Multiple result sets require the CLIENT_MULTI_RESULTS client capability.

Why does my recursive MariaDB procedure fail immediately?▼

Recursion is disabled by default because max_sp_recursion_depth defaults to 0. Set it to a nonzero value (range 0-255) before the call, for example SET max_sp_recursion_depth = 10, then invoke the recursive procedure.

What privilege is needed to execute a MariaDB stored procedure?▼

The caller needs the EXECUTE privilege on the procedure itself, granted directly or via broader routine or database-level grants. Table privileges used inside the procedure body are evaluated separately according to the routine's SQL SECURITY DEFINER or INVOKER clause.

Can CALL be used in a prepared statement in MariaDB?▼

Yes, CALL can be executed as a prepared statement with placeholders for IN, OUT, and INOUT parameters alike. Prepare the statement with PREPARE stmt FROM 'CALL sp_name(?, ?, ?)' and execute it with EXECUTE ... USING bound variables.