EXECUTE

+2
y
J
C
q

EXECUTE 语句为服务器端预处理语句提供 SQL 接口。

语法图

ExecuteStmt
EXECUTEIdentifierUSINGUserVariable,

示例

PREPARE mystmt FROM 'SELECT ? as num FROM DUAL';
Query OK, 0 rows affected (0.00 sec)
SET @number = 5;
Query OK, 0 rows affected (0.00 sec)
EXECUTE mystmt USING @number;
+------+ | num | +------+ | 5 | +------+ 1 row in set (0.00 sec)
DEALLOCATE PREPARE mystmt;
Query OK, 0 rows affected (0.00 sec)

MySQL 兼容性

EXECUTE 语句与 MySQL 完全兼容。如发现任何兼容性差异,请在 GitHub 上提交 issue

另请参阅

EXECUTE更新于 12/28/2022, 3:10:16 AM: v6.5: remove aliases (#12444)

文档内容是否有帮助?