可以通过以下示例来理解,在该示例中,我们通过使用预处理语句更新了名为“ Student”的表,该表具有以下数据:
mysql> Select * from Student; +------+-------+ | Id | Name | +------+-------+ | 1 | Ram | | 2 | Shyam | | 3 | Mohan | +------+-------+ 3 rows in set (0.00 sec) mysql> PREPARE stmt11 FROM 'UPDATE Student SET Name = ? WHERE Id = ?'; Statement prepared mysql> SET @A = 'Sohan', @B = 3; mysql> EXECUTE Stmt11 USING @A, @B; mysql> Select * from student; +------+-------+ | Id | Name | +------+-------+ | 1 | Ram | | 2 | Shyam | | 3 | Sohan | +------+-------+ 3 rows in set (0.00 sec)