Re: help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, Jul 02, 2003 at 16:51:11 -0400,
  yanping huang <yanping@xxxxxxxxxxx> 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


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux