Ekte bulduğum yazının örneği var, FireBird v1.0 Release Notes'tan alıntı,
Herkese kolay gelsin, bu fonksiyona ihtiyaç duyanlara da bir çeşit müjdeIn the new Firebird UDF library, FBUDF.dll
Development by Claudio Valderrama C., funded by Craig L. Leonardi
Distributed with this release is FBUDF.dll, the first Firebird UDF library using BY DESCRIPTOR syntax to
pass arguments, which provides more versatility. In declaring the functions in SQL, notice the
differences between the multiple declarations that map to the same function.
See, for example, that
INULLIF() is mapped to by both INULLIF() and I64NULLIF().
Author Claudio Valderrama comments that the library is still in beta and warns that it will probably
exhibit some bugs. So far it has not been compiled on any other platform but Windows. Bug reports
and comments are welcome.
The source and the DDL for declarations are in the Firebird CVS tree. To find them, select 'Browse the
CVS tree' from http://sourceforge.net/projects/firebird, click on 'Browse CVS Repository' and then
select Developers | Latest sources | interbase | extlib | fbudf.*.
NVL() functions for both exact precision ('invl') and string ('snvl') parameters
These functions attempt to mimic the NVL function of Oracle, to output an actual value when
the column has a NULL value. They take two arguments, the first being the expression being
tested for NULL, the second the value to output if the first argument is NULL. NVL will return
the first argument if it's not null and the second argument if the first one is null. If both are
null, you get null.
The pair of parameters should be compatible, either two numeric values (smallint, int, int64)
or two string values (char, varchar, cstring). The engine does not honor the parameter types
when using the technique exercised by FBUDF, so mixing a numeric and a string as arguments
will yield wrong results.
NULLIF() for string ('snullif'), integer ('inullif') and INT64 ('i64nullif') parameters
NULLIF should take two arguments, returning NULL if they are equivalent, or the result of the
first expression if they are not equivalent. Because of a shortcoming in the engine which
prevents NULL being returned from a UDF, each of these three functions returns a zeroequivalent.
This non-standard behaviour makes it not useful for "casting" certain values as
NULL in order to have aggregate functions ignore nulls.
NOTE that the function call to both the integer and int64 functions is the same ('inullif').
Day-of-Week functions - one returning a short string ('SDOW'), the other a longer one ('DOW'), from a
timestamp input. The return strings can be localized.
Several functions to add segments of time to a timestamp - 'addDay', 'AddWeek', etc.
A RIGHT() function (like RString in BASIC) to return the rightmost n characters from an input string.
A GetExactTimestamp() function returning the system timestamp with milliseconds precision.
Truncate()and i64truncate() truncate 32-bit and 64-bit integers respectively, taking scaled (exactprecision)
numerics of any range (up to 9 in Dialect 1 or up to 19 in Dialect 3) and returning the wholenumber
portion. They do not work with float or double types.
