Re: help - Mailing list pgsql-php

From Bruno Wolff III
Subject Re: help
Date
Msg-id 20030703112252.GB19441@wolff.to
Whole thread Raw
In response to help  (arun kv <arun@library.iisc.ernet.in>)
List pgsql-php
On Wed, Jul 02, 2003 at 16:51:11 -0400,
  yanping huang <yanping@altimate.ca> wrote:
> Hi,
> I am learning postgreSQL. Why I can't get a correct result using LPAD?

You are getting a correct result. If you review the documentation on LPAD
you will see that the length is the total length of the resulting string,
not the number of times to repeat the fill string.

>
> select LPAD('Hello',3);   not -> '   Hello'
>  lpad
> ------
>  Hel
>
> select LPAD('ello',3,'H'); not -> 'HHHello'
>  lpad
> ------
>  ell
>
> select LPAD('hen', 1, '^');
>  lpad
> ------
>  h
>
>
> How can I put a '^' befor a variable of VARCHAR type in a function?
>
> Yanping
> --
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org

pgsql-php by date:

Previous
From: Frank Bax
Date:
Subject: Re: query, display questions
Next
From: "Andrew J. Kopciuch"
Date:
Subject: Re: help