Subject | Re: [firebird-support] Result type of RPAD() and LPAD() |
---|---|
Author | Paul Vinkenoog |
Post date | 2011-01-10T11:40:41Z |
Hello Kjell,
to prevent this, you have to do something like
select rpad("x", maxvalue(6, char_length("x")), '-') from thetable
Paul Vinkenoog
> > Does this mean that if I have a varchar(n) col and want to pad thoseNo, not an exception; strings longer then <endlen> will be truncated. If you want
> > values that are shorter than k chars to m chars (n>= m>= k), I can't
> > do it without also truncating values longer than m to m chars?
> >
> > E.g. column "x" is varchar(10) and I have these values:
> >
> > 'abcdefghij'
> > 'a'
> > 'abcde'
> >
> > select rpad("x", '-', 6) from thetable
>
> Sorry, that should be:
> select rpad("x", 6, '-') from thetable
>
> > would return this:
> >
> > 'abcdef'
> > 'a-----'
> > 'abcde-'
> >
> > Or would it throw an exception?
to prevent this, you have to do something like
select rpad("x", maxvalue(6, char_length("x")), '-') from thetable
Paul Vinkenoog