Subject Re: Result type of RPAD() and LPAD()
Author chris.waldmann
--- In firebird-support@yahoogroups.com, Paul Vinkenoog <paul@...> wrote:
>
> Hello Chris,
>
> > In the documentation for LPAD and RPAD is written that the result type is VARCHAR(32765) and there is a tip to cast the result to a useful length.
> >
> > When using LPAD or RPAD in a "SELECT LPAD( LABEL, 8, '-' ) FROM...", FlameRobin and IBExpert both return a VARCHAR(8), corresponding to the length argument of xPAD(), without casting.
> >
> > My question: is the cast still recommended or obsolete?
>
> In Firebird 2.5, the result is VARCHAR(n) with n equal to the second argument.
>
> I didn't know that it was backported to 2.1.4 as well.
>
> You can forget the casts, then.
>
> > I use the internal functions. Is the behavior different if I use the external functions from ib_udf.dll?
>
> Yes. You declare them with the desired output length. But don't bother with them. Stick to the internal functions, since they behave so well now.
>
>
> Cheers,
> Paul Vinkenoog
>
Thanks Paul

I didn't realized that this is new in the 2.1.4 version. With version 2.1.3.18185, the result is, as documented, VARCHAR(32764) or STRING(8196), based on encoding.

Chris