title | summary | aliases | ||
---|---|---|---|---|
EXECUTE |
TiDB 数据库中 EXECUTE 的使用概况。 |
|
EXECUTE
语句为服务器端预处理语句提供 SQL 接口。
ExecuteStmt ::=
'EXECUTE' Identifier ( 'USING' UserVariable ( ',' UserVariable )* )?
{{< copyable "sql" >}}
PREPARE mystmt FROM 'SELECT ? as num FROM DUAL';
Query OK, 0 rows affected (0.00 sec)
{{< copyable "sql" >}}
SET @number = 5;
Query OK, 0 rows affected (0.00 sec)
{{< copyable "sql" >}}
EXECUTE mystmt USING @number;
+------+
| num |
+------+
| 5 |
+------+
1 row in set (0.00 sec)
{{< copyable "sql" >}}
DEALLOCATE PREPARE mystmt;
Query OK, 0 rows affected (0.00 sec)
EXECUTE
语句与 MySQL 完全兼容。如发现任何兼容性差异,请在 GitHub 上提交 issue。