Creating and executing user-defined functions

User-defined functions (UDFs) are a class of procedures that return a single value to the calling environment. This section introduces creating, using, and dropping user-defined functions.

There are four steps required to create and use a UDF:


  1. Declare the user-defined function using the CREATE AGGREGATE FUNCTION statement or the CREATE FUNCTION statement.
  2. Implement the function entry point(s) in C/C++.
  3. Compile the implementation and link it as a shared library.
  4. Use the function within a SQL statement anywhere that you would use a built-in SQL function.


Created November 2, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com