Re: Formatting Function..

From: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
To: Vinay Jain <vinayjain(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Formatting Function..
Date: 2004-07-05 13:20:07
Message-ID: 1089033606.910.2.camel@taz.oficina
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

you should try with rpad and lpad functions:

select rpad('hello world', 20, '*'); ---> hello world*********
select lpad('hello world', 20, '*'); ---> *********hello world

hope this is what you were looking for.

On Mon, 2004-07-05 at 02:19, Vinay Jain wrote:

> Hi..
> I am newbe in postgresql so please help me though the question may be
> very easy to answer..
> Is there any formatting function to get output with fix lengths..for
> example my query is..
> schema is:
>
> Student
> (name Varchar,
> age integer);
>
> select name, age from student;
> the output is like this..
> Name | Age
> xyz | 22
>
> I want this length of name to be of my choice...is it possible..& how..
>
> thanks in advance
> Regards
> Vinay
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-07-05 14:09:35 Re: Bug in function to_char() !!
Previous Message Kazuya Togashi 2004-07-05 12:21:35 Difference in text/char data matching between 7.3.4 & 7.4.2