在 MySQL 中更改小数点分隔符

2021-11-20 00:00:00 locale decimal-point mysql

是否可以将十进制逗号从."更改为(点)到 MySQL 输出中的其他字符(逗号)?我不想使用像 FORMAT 这样的函数,我只想使用我通常使用的所有查询而不做任何修改.我正在寻找一些设置(一些变量、语言环境等).我试图搜索手册但没有成功.

Is it possible to change the decimal comma from "." (dot) to other character (comma) in MySQL output? I don't want to use functions like FORMAT, I just want to use all the queries I normaly use without any modification. I'm looking for some setting (of some variable, locale etc.). I tried to search the manual but without success.

推荐答案

不,你不能.这是 SQL 标准,MySQL 遵守它(至少在这一点上).

No, you can't. That's the SQL standard and MySQL complies with it (in that point at least).

问题实际上不在于输出(正如您提到的,大多数 DBMS 中有各种 FORMAT 函数),而在于 INSERT.如果您可以使用逗号 , 例如作为小数点(这在其他语言环境中很常见),它也用作值分隔符,插入将变得不明确.请参阅我在问题中的回答:insert-non-english-decimal-points-in-mysql

The problem is not really with output (as you mention, there are various FORMAT functions in most DBMSs) but with INSERT. If you could use comma , for example as decimal point (that's common in other locales) which is aslo used as values separator, Inserts would become ambiguous. See my answer in the question: insert-non-english-decimal-points-in-mysql

相关文章