User-defined function

This is an old revision of this page, as edited by RevRagnarok (talk | contribs) at 11:56, 17 June 2006 (Merge). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A User Defined Function, or UDF, is a function provided by the user of a program or environment, in a context where the usual assumption is that functions are built into the program or environment.

BASIC language

In some old implementations of the BASIC programming language, user defined functions are defined using the "DEF FN" syntax. More modern dialects of BASIC are influenced by the structured programming paradigm, where most or all code is written as user defined functions or procedures, and the concept becomes practically redundant.


Databases

In some databases, a UDF or stored procedure is an extension to the database server (like MySQL) that can be compiled for use in an SQL query. For example, sometimes it may be necessary to obtain a random number for use as a primary key (a function that MySQL does not internally support). In this case, a new external function could be written and compiled to accomplish this task.

One sample of such a query could be: SELECT GETRANDOMKEY();.

Essentially, this external function becomes part of the server itself. This can also known as a user exit (e.g. in the Adabas database)