Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.


                     - Thomas

In response to


pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group