Subject Re: [firebird-support] Re: coalesce
Author Mark Rotteveel
On 25-3-2015 19:25, Dmitry Yemanov dimitr@...
[firebird-support] wrote:
> 25.03.2015 19:43, 'checkmail' wrote:
>
>> one short question, why is the Result of
>> coalesce(:variableVarchar(10),‘NULL‘) not ‚NULL‘ but rather ‘NULL ‘
>> with blanks from varchar(10) length?
>
> Because the resulting length is determined by the longest argument. It's
> fixed at the compile time.

If I test something similar on Firebird 3 and 2.5 using a select and
using EXECUTE BLOCK, then a COALESCE(anullvarchar10, 'NULL') will result
in a VARCHAR(10) that is not padded to spaces. Using a CHAR(10) will -
as expected - pad with spaces.

It seems to depend on the context of the query, or that
variablevarchar(10) is not actually varchar(10), but char(10).

Mark
--
Mark Rotteveel