另一个相似之处是准备好的语句也不像 MySQL 用户变量那样区分大小写。例如,stmt11 和 STMT11 都与以下示例所示相同 -
mysql> Select * from student;
+------+-------+
| Id | Name |
+------+-------+
| 1 | Ram |
| 2 | Shyam |
| 3 | Rohan |
+------+-------+
3 rows in set (0.00 sec)
mysql> SET @A = 'Sohan', @B = 3;
Query OK, 0 rows affected (0.00 sec)
mysql> EXECUTE Stmt11 USING @A, @B;
Query OK, 1 row affected (0.12 sec)
mysql> Select * from Student;
+------+-------+
| Id | Name |
+------+-------+
| 1 | Ram |
| 2 | Shyam |
| 3 | Sohan |
+------+-------+
3 rows in set (0.00 sec)
mysql> SET @A = 'Gaurav', @B = 3;
Query OK, 0 rows affected (0.00 sec)
mysql> EXECUTE STMT11 USING @A, @B;
Query OK, 1 row affected (0.04 sec)
mysql> Select * from Student;
+------+--------+
| Id | Name |
+------+--------+
| 1 | Ram |
| 2 | Shyam |
| 3 | Gaurav |
+------+--------+
3 rows in set (0.00 sec)
登录后复制
在上面的示例中,一旦我们执行了 stmt11 ,下次执行 STMT11 时,它们的工作方式都是相同的,因为准备好的语句不区分大小写。
以上就是准备好的语句和 MySQL 用户变量有什么相似之处?的详细内容,更多请关注每日运维网(www.mryunwei.com)其它相关文章!