Subject Re: [firebird-support] Using external functions in Views
Author Helen Borrie
At 05:20 PM 1/06/2006, you wrote:
>Thanks Helen,
>
>I've used the correct view syntax. However, I think I
>might have some problem with my setup.
>
>When I'm trying
>
>select truncate(fTarif) from "MyTable"
>
>I get the error message:
>
>Dynamic SQL Error.
>SQL error code = -804.
>Function unknown.
>TRUNCATE.
>
>Same thing for:
>
>select abs(-1) from rdb$database;
>
>An error was found in the application program input
>parameters for the SQL statement.
>Dynamic SQL Error.
>SQL error code = -804.
>Function unknown.
>ABS.
>
>It looks like I can't use any external function. Do I
>have to enable those explicitly somewhere?

Yes, of course you do. You have to declare external functions to the
database, e.g.
declare external function Truncate
int by descriptor, int by descriptor
returns parameter 2
entry_point 'fbtruncate' module_name 'fbudf';

See the "...SQL" files that accompany any external function
libraries. Don't guess at their names, either. You can declare a
function with any (valid) name but you must call it by that name.

You have to declare all of the external funcs you want to use. A lot
of people keep a script of their favourite declarations in their
toolbox and just run it over new databases as a matter of course.

./heLen