mysql存储过程中的本地变量会被一个内部函数name_const转化,似乎是专门为存储过程设计的,没有提到有其它特别之处.
 
delimiter //
create procedure pload()
BEGIN
declare j int default 1;
while j<=1000000
do
  insert into test(id2,name) values(j,'aaaaaaaaaaaaaaaaaaaaaaa');
  set j=j+1;
end while;
end;
//
delimiter ;
 
call pload();
 
mysql>show processlist;
 
查看线程列表,发现类似语句
mysql> show processlist;
+----+------+-----------+------+---------+------+--------+--------------------------------------------------------------------------------------+
| Id | User | Host      | db   | Command | Time | State  | Info                                                                                 |
+----+------+-----------+------+---------+------+--------+--------------------------------------------------------------------------------------+
|  3 | root | localhost | test | Query   |    0 | update | insert into test(id2,name) values( NAME_CONST('j',600610),'aaaaaaaaaaaaaaaaaaaaaaa') |


Returns the given value. When used to produce a result set column, NAME_CONST() causes the column to have the given name. The arguments should be constants.
mysql> SELECT NAME_CONST('myname', 14);
+--------+
| myname |
+--------+
|     14 |
+--------+ 
This function is for internal use only. The server uses it when writing statements from stored programs that contain references to local program variables, as described in Section 19.6, “Binary Logging of Stored Programs”, You might see this function in the output from mysqlbinlog