List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:August 20 1999 9:09pm
Subject:Re: Formatting numbers, MySQL or Perl?
View as plain text  
On Fri, 1999-08-20 22:39:51 +0200, Juan Riera wrote:
> I need to change the dot in decimal numbers to comma, as in european
> numbers, i.e. 30.000 -> 30,000

Juan, have a look at: man perllocale

Starting with Perl 5.004, you can activate locale handling with
   use locale;

Perl example:
   require 5.004;
   use locale;
   printf ("%f\n", 3.1415);
Output for me (LC_NUMERIC=de):

So you won't have to actually change your numbers, you simply change
their output format.

IF you really want to replace the dot character on the MySQL side, use
the REPLACE function.  Example:
    mysql> SELECT REPLACE(3.14, '.', ',');
    | REPLACE(3.14, '.', ',') |
    | 3,14                    |
    1 row in set (0.04 sec)
Note: the number first will be converted into a string,
      then REPLACE will work on that string.

Martin Ramsch <m.ramsch@stripped> <URL: >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Formatting numbers, MySQL or Perl?Juan Riera20 Aug
  • Re: Formatting numbers, MySQL or Perl?Martin Ramsch20 Aug
Re:Error/crash with InnoDB if table name = database nameHeikki Tuuri20 Jun
Re:Error/crash with InnoDB if table name = database nameMarkus Wichitill21 Jun