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


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

30.4.4.3 execute_prepared_stmt() Procedure

将一个SQL语句字符串作为预处理语句执行。预处理语句在执行后被释放,因此该过程主要用于执行一次性动态语句。

该过程使用sys_execute_prepared_stmt作为预处理语句名称。如果在调用过程时该语句名称存在,之前的内容将被销毁。

  • in_query LONGTEXT CHARACTER SET utf8mb3:要执行的语句字符串。

execute_prepared_stmt()操作可以使用以下配置选项或相应的用户定义变量来修改(见Section 30.4.2.1, “The sys_config Table”):

  • debug, @sys.debug

    如果该选项设置为ON,则生成调试输出。默认情况下是OFF

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