pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yasir Malik <ymalik@cs.stevens-tech.edu>
To: pgsql-sql@postgresql.org
Subject: Datatype conversion help
Date: Tue, 8 Jul 2003 16:07:05 -0400
Message-ID: <Pine.SGI.4.51.0307081604030.4185018@guinness.cs.stevens-tech.edu> (raw)

Suppose I have an integer between 0 and 99 and I want to covert it to
string, and pad leading zeros if neccessary.  For example,
1  => 01
10 => 10

I've tried to_char(in_val, '99'), and that returns a string that is two
charecters, but there isn't a leading zero incase I have the number 2 as
input.  Any ideas?  Thanks.
Yasir



view thread (13+ messages)  latest in thread

Message-ID: <Pine.SGI.4.51.0307081604030.4185018@guinness.cs.stevens-tech.edu>
Permalink:  ../Pine.SGI.4.51.0307081604030.4185018@guinness.cs.stevens-tech.edu/
Also on:    postgresql.org/message-id/Pine.SGI.4.51.0307081604030.4185018@guinness.cs.stevens-tech.edu

 · 

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: ymalik@cs.stevens-tech.edu
  Subject: Re: Datatype conversion help
  In-Reply-To: <Pine.SGI.4.51.0307081604030.4185018@guinness.cs.stevens-tech.edu>

* 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