DEALLOCATE

The DEALLOCATE statement provides an SQL interface to server-side prepared statements.

Synopsis

DeallocateStmt

DEALLOCATE - 图1

DeallocateSym

DEALLOCATE - 图2

Identifier

DEALLOCATE - 图3

  1. DeallocateStmt ::=
  2. DeallocateSym 'PREPARE' Identifier
  3. DeallocateSym ::=
  4. 'DEALLOCATE'
  5. | 'DROP'
  6. Identifier ::=
  7. identifier
  8. | UnReservedKeyword
  9. | NotKeywordToken
  10. | TiDBKeyword

Examples

  1. mysql> PREPARE mystmt FROM 'SELECT ? as num FROM DUAL';
  2. Query OK, 0 rows affected (0.00 sec)
  3. mysql> SET @number = 5;
  4. Query OK, 0 rows affected (0.00 sec)
  5. mysql> EXECUTE mystmt USING @number;
  6. +------+
  7. | num |
  8. +------+
  9. | 5 |
  10. +------+
  11. 1 row in set (0.00 sec)
  12. mysql> DEALLOCATE PREPARE mystmt;
  13. Query OK, 0 rows affected (0.00 sec)

MySQL compatibility

The DEALLOCATE statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also