Subject Re: RES: [firebird-support] soundex
Author Kjell Rilbe
Helen Borrie wrote:
> At 01:12 AM 15/11/2005 -0200, you wrote:
>
>>UPDATE indcemit set classificado = F_GENERATESNXINDEX(falecido)
>>
>>It works well with all tables but one. On this special table the script
>>hangs and no result is reached. I have to reset my computer.
>
> ERm, could it be that falecido is nullable on that table? UDFs of the
> traditional kind get unhappy if passed a null as input. For a safe update
> statement, you should do this:
>
> UPDATE indcemit set classificado = F_GENERATESNXINDEX(falecido)
> where falecido is not null

Or:

UPDATE indcemit
set classificado =
case
when falecido is null then null
else F_GENERATESNXINDEX(falecido)
end

This will set classificado to null if falecido is null, which I would
assume is what you want. You could also try:

UPDATE indcemit
set classificado = F_GENERATESNXINDEX(coalesce(falecido, ''))

This will pass an empty string to the soundex function if falecido is
null, so classificado will be set to whatever soundex returns for an
empty string.

Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64