> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/execute-statement.md).

# EXECUTE Statement

## Syntax

```bnf
EXECUTE stmt_name
    [USING expression[, expression] ...]
```

## Description

After preparing a statement with [PREPARE](/docs/server/reference/sql-statements/prepared-statements/prepare-statement.md), you execute it with an`EXECUTE` statement that refers to the prepared statement name. If the prepared statement contains any parameter markers, you must supply a`USING` clause that lists expressions containing the values to be bound to the parameters. The `USING` clause must name exactly as many expressions as the number of parameter markers in the statement.

You can execute a given prepared statement multiple times, passing different variables to it or setting the variables to different values before each execution.

If the specified statement has not been PREPAREd, an error similar to the following is produced:

```sql
ERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to EXECUTE
```

{% tabs %}
{% tab title="Current" %}
`EXECUTE` with arbitrary expression as parameters can be used, not just user variables (@var\_name).
{% endtab %}

{% tab title="< 10.2.3" %}
You can only use user variables (@var\_name) as parameters.
{% endtab %}
{% endtabs %}

## Example

See [example in PREPARE](/docs/server/reference/sql-statements/prepared-statements/prepare-statement.md#example).

## See Also

* [EXECUTE IMMEDIATE](/docs/server/reference/sql-statements/prepared-statements/execute-immediate.md)

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/execute-statement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
