Subject Re: [ib-support] UDF and Raising Exception
Author Martijn Tonies
Hi,

> Any one try on using UDF on FreeUDf Lib to construct the function
> which can validate the insertion of string whether it consist of
> ascii character e.g @# or there are spaces in between?
>
> I need to raise exception whenever user enter the code such as 'David
> @ $', 'D avid',....
> is there any good suggestion on constructing the UDF function to
> validate these kind string insertion??

Return a result from the UDF (integer result) - which is will be 0
(zero) on OK, another value on failure.

Create an exception via CREATE EXCEPTION.

Then, from your procedure/trigger do:

declare variable myvar integer;
begin
myvar = myudf(....parameters....);
if (myvar <> 0) then exception <exceptionname>;
end


With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com

See you at the First European Firebird Conference in May in Fulda, Germany
http://www.firebird-conference.com