Subject Re: select where field contains non-ascii characters
Author Adam
--- In firebird-support@yahoogroups.com, "Erik LaBianca" <erik@...> wrote:
>
> Hello All,
>
>
>
> Apologies if this has been covered before, google isn't getting me very
> far.
>
>
>
> I'd like to be able to select rows in firebird 1.5.3 that contain
> non-ascii characters. Something like select * from table where not
> isalnum(field). Is there an elegant way to do this without resorting to
> writing and deploying a custom UDF? If I need a UDF, is there a library
> already out there with a suitable function in it? I'm not seeing
> anything that looks like it could do it in fbudf or ib_udf.

I think you could mock up your own stored procedure that accepted as
input the varchar and returned 'T' or 'F' (or whatever the syntax)
using the UDF functions that ship with Firebird and a PSQL loop.

Particularly:

strlen
substr
ascii_val

You could use strlen and substr to parse each character, and for each
character identify the ascii_val. If that is in the acceptable range
You could maybe request the ascii_val for each character within the
string.

Otherwise you can roll your own UDF function library with whatever
language best suits.

Adam