pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedpadding an integer ...
2+ messages / 2 participants
[nested] [flat]
* padding an integer ...
@ 2005-10-26 03:57 Marc G. Fournier <scrappy@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: Marc G. Fournier @ 2005-10-26 03:57 UTC (permalink / raw)
To: pgsql-sql
Is there any way of "padding" an integer, similar to how, in perl, I would
do:
printf("%03d", 1);
to get:
001
Specifically, I'm looking to do this in a pl/pgsql function ... like to
avoid moving to pl/php or pl/perl if I can ... but, from what I've been
able to find, I suspect I'm not going to have much of a choice ...
----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: padding an integer ...
@ 2005-10-26 04:11 Michael Fuhr <mike@fuhr.org>
parent: Marc G. Fournier <scrappy@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Michael Fuhr @ 2005-10-26 04:11 UTC (permalink / raw)
To: Marc G. Fournier <scrappy@postgresql.org>; +Cc: pgsql-sql
On Wed, Oct 26, 2005 at 12:57:25AM -0300, Marc G. Fournier wrote:
> Is there any way of "padding" an integer, similar to how, in perl, I would
> do:
>
> printf("%03d", 1);
>
> to get:
>
> 001
test=> SELECT to_char(1, '000');
to_char
---------
001
(1 row)
http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html
--
Michael Fuhr
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-10-26 04:11 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-26 03:57 padding an integer ... Marc G. Fournier <scrappy@postgresql.org>
2005-10-26 04:11 ` Michael Fuhr <mike@fuhr.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox