Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 885 Bytes

prepare.md

File metadata and controls

45 lines (31 loc) · 885 Bytes
title summary category
PREPARE
TiDB 数据库中 PREPARE 的使用概况。
reference

PREPARE

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

语法图

PreparedStmt:

PreparedStmt

示例

mysql> PREPARE mystmt FROM 'SELECT ? as num FROM DUAL';
Query OK, 0 rows affected (0.00 sec)

mysql> SET @number = 5;
Query OK, 0 rows affected (0.00 sec)

mysql> EXECUTE mystmt USING @number;
+------+
| num  |
+------+
| 5    |
+------+
1 row in set (0.00 sec)

mysql> DEALLOCATE PREPARE mystmt;
Query OK, 0 rows affected (0.00 sec)

MySQL 兼容性

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

另请参阅