Bug #40071 second argument of FORMAT() can't be variable or expression
Submitted: 16 Oct 2008 9:12 Modified: 16 Oct 2008 9:17
Reporter: Dmitry Samborskiy Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.45 OS:Any
Assigned to: CPU Architecture:Any
Tags: format

[16 Oct 2008 9:12] Dmitry Samborskiy
Description:
By some obscure reason in FORMAT(X, D) function
call D should be integer constant (FORMAT()
doesn't accept either variable or numeric expression).

How to repeat:
mysql> SELECT FORMAT(12332.123456, 4);
+-------------------------+
| FORMAT(12332.123456, 4) |
+-------------------------+
| 12,332.1235             | 
+-------------------------+
1 row in set (0.00 sec)

mysql> SELECT FORMAT(12332.123456, 1+3);
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 '+3)' at line 1
[16 Oct 2008 9:17] Sveta Smirnova
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Duplicate of bug #12664