Subject Re: [ib-support] AVG() on char field.
Author Martijn Tonies
Hi,

Helens solution with a shadow column works fine, or course :)

My approach would (in Delphi, never written an UDF myself) look something
like:

function MyUDF(var Value: string): Integer;
begin
Result := StrToIntDef(Value, -MaxInt);
end;

in case of error, it would return -MaxInt, the 'break out' value for the
query.

select * from mytable where myudf(column) > -21... something...

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."




Thanks Helen&Martin..

Helen,
That was a nice solution.
But is it good to do something like this with 10millions of records?
Or is it a design error that I've done with the table?

Martin, can you please give some tips on how that udf would be like?