Documentation Home
MySQL 8.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.9Mb
PDF (A4) - 40.0Mb
Man Pages (TGZ) - 258.4Kb
Man Pages (Zip) - 365.5Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb

MySQL 8.4 Reference Manual  /  ...  /  The execute_prepared_stmt() Procedure The execute_prepared_stmt() Procedure

Given an SQL statement as a string, executes it as a prepared statement. The prepared statement is deallocated after execution, so it is not subject to reuse. Thus, this procedure is useful primarily for executing dynamic statements on a one-time basis.

This procedure uses sys_execute_prepared_stmt as the prepared statement name. If that statement name exists when the procedure is called, its previous content is destroyed.

  • in_query LONGTEXT CHARACTER SET utf8mb3: The statement string to execute.

Configuration Options

execute_prepared_stmt() operation can be modified using the following configuration options or their corresponding user-defined variables (see Section, “The sys_config Table”):

  • debug, @sys.debug

    If this option is ON, produce debugging output. The default is OFF.

mysql> CALL sys.execute_prepared_stmt('SELECT COUNT(*) FROM mysql.user');
| COUNT(*) |
|       15 |