Re: [SQL] RETURN VALUES ON INTEGERS

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: Alessandro Rossi <alex(at)sunrise(dot)radiostudiodelta(dot)it>, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] RETURN VALUES ON INTEGERS
Date: 1999-07-07 12:52:51
Message-ID: l03130303b3a8fdf5f0d5@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 15:24 +0300 on 07/07/1999, Alessandro Rossi wrote:

> I GET:
>
> id|code|status
> --+------+------
> 1| 44111|N
> 2| 123|S
>
> BUT I WOULD LIKE TO GET
>
> id|code|status
> --+------+------
> 1|044111|N
> 2|000123|S
>
> How could I fix the prbolem and get the values as I ned them out of the
> select ?

Try lpad. For example:

testing=> select num, lpad( num, 6, '0' ) from test1;
num| lpad
------+------
2|000002
4|000004
38|000038
199|000199
100399|100399
(5 rows)

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John Ridout 1999-07-07 14:36:15 RE: [SQL] RETURN VALUES ON INTEGERS
Previous Message Alessandro Rossi 1999-07-07 12:24:16 RETURN VALUES ON INTEGERS