Re: Formating numbers useing to_char: how to get rid of leading space?

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Erich <hh(at)cyberpass(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Formating numbers useing to_char: how to get rid of leading space?
Date: 2000-09-25 08:13:54
Message-ID: Pine.LNX.3.96.1000925101111.28122A-100000@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sun, 24 Sep 2000, Erich wrote:

>
> I'm trying to format some numbers using to_char, like this:
>
> SELECT TO_CHAR(34, '099999');
>
> Whenever I do this, I always get a leading space, if the int is
> positive. I looked at the manual, and all the examples had leading
> spaces. Is there a way to get rid of this using TO_CHAR, or should I

Try read docs again...

test=# SELECT '>' || TO_CHAR(34, '099999') || '<';
?column?
-----------
> 000034<
(1 row)

test=# SELECT '>' || TO_CHAR(34, 'FM099999') || '<';
?column?
----------
>000034<
(1 row)

'FM' = fill mode

Karel

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Louis-David Mitterrand 2000-09-25 13:44:18 SPI vs. libpq for function programming
Previous Message Philip Warner 2000-09-25 03:25:29 Re: Case Studies for PostgresSQL