skip to main content
Functions : User-defined functions
 

User-defined functions

OpenAccess SDK supports extension of the built-in set of scalar functions. The IP can register with the OpenAccess SDK SQL engine and implement scalar functions that take one or more arguments. This allows you to support additional functionality beyond that provided by the built in functions.
A user-defined function can be used just like the built-in functions. It is defined in terms of the number of arguments and the type of output. Below is an example of using a varf() function to store the value of comm field.
INSERT INTO emp (empno, ename, deptno, comm) VALUES (1,'joe', 2, varf())
An IP supports additional scalar functions by registering information about the scalar function in the scalar_functions array.