User-defined function: Difference between revisions

Content deleted Content added
Line 12:
In [[relational database management system]]s, a user-defined function provides a mechanism for extending the functionality of the [[database server]] by adding a function, that can be evaluated in standard query language (usually [[SQL]]) statements. The [[ISO/IEC 9075|SQL standard]] distinguishes between [[Scalar (computing)|scalar]] and table functions. A scalar function returns only a single value (or [[null (SQL)|NULL]]), whereas a table function returns a (relational) table comprising zero or more rows, each row with one or more columns.
 
User-defined functions in SQL are declared using the <code>CREATE FUNCTION</code> statement. For example, a user-defined function that converts Celsius to Fahrenheit (a temperature scale used in USA) might be declared like this:
<syntaxhighlight lang="sql">
CREATE FUNCTION dbo.CtoF(Celsius FLOAT)