Subject Re: [firebird-support] Concatenated field return null when only one field is null
Author Jason Dodson
Select Coalesce(PA_COLOR_GROUP_CODE, '') || ' ' ||
Coalesce(PA_COLOR_CUST_REF, '')...

That will get you what you want, most likely. You can not (at least you
shouldn't be able to) do operations on a NULL field. NULL does NOT mean
"Has a value of nothing", but rather "Has no value". With that, this
behavior should make more sense.

As a rule of thumb for myself, which I recommend to anyone, make String
fields NOT NULL, and simply enter a blank string when they have no data.
Numbers define as NOT NULL, but default to 0. Everything else, such as
Dates, BLOBS, etc should be the only thing capable of housing a NULL
value, because operations are not permitted on these AND the purpose of
a NULL isnt ambiguous.

Jason



Almond wrote:
> I have a computed field which concatenate 2 field :
>
> PA_COLOR_GP_REF Computed by: (PA_COLOR_GROUP_CODE || ' ' || PA_COLOR_CUST_REF)
>
> PA_COLOR_GP_REF return <null> if PA_COLOR_CUST_REF is null, even
> PA_COLOR_GROUP_CODE contains data. I'm using firebird 1.0
>
> Best regards,
>
> Almond Wong
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>