Subject Re: [ib-support] Problem with Varchars and null
Author Daniel Rail
Comments below.

At 23/01/2002 08:29 AM, you wrote:
>Hi everybody,
>
> I'm in a problem. I have Interbase 6/NT and I'm trying to do
>this:
>
> Select Ab.Surname || ', ' || Ab.Name as Name
> .....
> from Abogado Ab,
> ......
> where ..............
>
> The problem is Ab.Name in some cases is null .... and for my
>surprise all the operation of concatenating is null. Why? In other databases
>the result is Ab.Surname || ', '. This is a bug?

This is not a bug. As per SQL-92 standards, this is how a concatenation of
strings works.

>Can I resolve this?

Yes.

>How?

By using a Stored Procedure or a UDF to concatenate the string fields. You
would have something like this:

FullName = Ab.Surname;
if Ab.Name is not null then
FullName = FullName || ', ' || Ab.Name;

This is just an example of just how part the Stored Procedure would be written.

I use this type of Stored Procedure all the time and it works great. You
simply have to make it the way you want it to function.

Hope this helps.


Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)