Re: problem with to_char

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: Carsten Grewe <DerReisende(at)schatzis(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: problem with to_char
Date: 2002-01-29 13:13:44
Message-ID: 3C56A008.E05D299@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I think I have not understood some elementary things of the to_char function
> in pgsql7.1.2. I only get back a mask instead of a formatted string.
> I tried the following in psql:
> SPS=> select to_char(45145, '9.999,99');
> to_char
> -----------
> #.###,##
> (1 row)

The number will not fit into the field you have defined, so it is filled
with hash marks to indicate overflow.

If your locale is not set up to recognize "european style" numbers, then
in this case you have defined a formatting string which allows only
numbers less than 10. If you are set up to recognize european formatting
(I'm not familiar with this for to_char(); see the docs) then you have
defined a formatting string with allows only numbers less than 9999,
which still won't hold the number you are asking it to format for you.

Try to_char(45145, '99,999.99') and to_char(45145, '99.999,99'); one of
them will work.

hth

- Thomas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Frank Schafer 2002-01-29 13:25:43 Re: unique & update
Previous Message Frank Schafer 2002-01-29 12:41:16 Re: Multibyte encoding vs. SQL_ASCII and European