mysql> call productpricing();
ERROR 1436 (HY000): Thread stack overrun:  10368 bytes used of a 131072 byte stack, and 128000 bytes needed.  Use 'mysqld --thread_stack=#' to specify a bigger stack.

解决办法:

vim /etc/my.cnf
thread_stack = 128K   ##原来为128,根据报错提示,我改大一点
/etc/init.d/mysqld restart

效果:

mysql> call productpricing();
+--------------+
| priveaverage |
+--------------+
|    16.133571 |
+--------------+
1 row in set (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
mysql>