Who Can Create an External Function
The DECLARE EXTERNAL FUNCTION
statement can be executed by:
-
Users with the
CREATE FUNCTION
privilege
The user who created the function becomes its owner.
Examples using DECLARE EXTERNAL FUNCTION
-
Declaring the
addDay
external function located in thefbudf
module.The input and output parameters are passed by reference.DECLARE EXTERNAL FUNCTION addDay TIMESTAMP, INT RETURNS TIMESTAMP ENTRY_POINT 'addDay' MODULE_NAME 'fbudf';
-
Declaring the
invl
external function located in thefbudf
module.The input and output parameters are passed by descriptor.DECLARE EXTERNAL FUNCTION invl INT BY DESCRIPTOR, INT BY DESCRIPTOR RETURNS INT BY DESCRIPTOR ENTRY_POINT 'idNvl' MODULE_NAME 'fbudf';
-
Declaring the
isLeapYear
external function located in thefbudf
module.The input parameter is passed by reference, while the output parameter is passed by value.DECLARE EXTERNAL FUNCTION isLeapYear TIMESTAMP RETURNS INT BY VALUE ENTRY_POINT 'isLeapYear' MODULE_NAME 'fbudf';
-
Declaring the
i64Truncate
external function located in thefbudf
module.The input and output parameters are passed by descriptor.The second parameter of the function is used as the return value.DECLARE EXTERNAL FUNCTION i64Truncate NUMERIC(18) BY DESCRIPTOR, NUMERIC(18) BY DESCRIPTOR RETURNS PARAMETER 2 ENTRY_POINT 'fbtruncate' MODULE_NAME 'fbudf';