User defined functions
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
OpenEdge SQL provides support for User Defined Functions (UDF) which allow users to extend SQL functionality. A User Defined Function contains the logic, accepts the input parameters, and returns a scalar value as the result. User Defined Functions can help reduce network traffic. A complex set of logic that has the potential to filter out a large portion of result set rows, like a Regular Expression, which cannot be represented as a single scalar expression can be expressed as a User Defined Function. User Defined Functions allow users the advantage of having modularity in their code and also provides the flexibility of reusing UDF.
The process of creating a User Defined Function (UDF) is similar to that of
creating a stored procedure. There are input parameters and the body of the UDF (its program
logic) is written in Java, with all the power of Java. A UDF is used like a SQL function, such
as a SUBSTRING, and is fully integrated with query
execution.