【发布时间】:2013-09-21 05:28:44
【问题描述】:
我尝试了以下 -
我在命令提示符下创建了一个变量如下 -
mysql> set @myId = 1;
Query OK, 0 rows affected (0.00 sec)
然后,为了显示它,我尝试了以下但没有成功 -
mysql> show myId;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'myId' at line 1
mysql> show @myId;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '@myId' at line 1
mysql> PRINT @myId;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'PRINT @myId' at line 1
mysql> PRINT myId;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'PRINT myId' at line 1
那么如何显示@myId 的值呢?
【问题讨论】:
标签: mysql variables command-line