pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Marc G. Fournier <scrappy@postgresql.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: padding an integer ...
Date: Tue, 25 Oct 2005 22:11:37 -0600
Message-ID: <20051026041137.GA18613@winnie.fuhr.org> (raw)
In-Reply-To: <20051026005530.E993@ganymede.hub.org>
References: <20051026005530.E993@ganymede.hub.org>

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



view thread (2+ messages)

Message-ID: <20051026041137.GA18613@winnie.fuhr.org>
Permalink:  ../20051026041137.GA18613@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20051026041137.GA18613@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, scrappy@postgresql.org
  Subject: Re: padding an integer ...
  In-Reply-To: <20051026041137.GA18613@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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