Specifying a Return Value
Go Up to Writing a UDF
A UDF can return values that can be translated into any InterBase data type, including a Blob, but it cannot return arrays of data types. For example, the C function declaration for FN_ABS()
returns a value of type double, which corresponds to the InterBase DOUBLE PRECISION
data type.
By default, return values are passed by reference. Numeric values can be returned by reference or by value. To return a numeric parameter by value, include the optional BY VALUE
keyword after the return value when declaring a UDF to a database.
A UDF that returns a Blob does not actually define a return value. Instead, a pointer to a structure describing the Blob to return must be passed as the last input parameter to the UDF. See Declaring a Blob UDF.
- Note: A parameter passed as a descriptor cannot be used as a return type. This action will throw an error. For more information about the DESCRIPTOR parameter, see Defining a Sample UDF with a Descriptor Parameter.