If no built-in functions encapsulate the logic that you require, you can create your own user-defined functions. User-defined functions are a great way of extending the basic set of SQL functions.
Whether you or a group of users need a function to implement a complex mathematical formula, specific string manipulation, or to do some semantic transformations of values, you can easily create a high-performance SQL function to do this that can be referenced like any existing built-in SQL function.
For example, consider a user that requires a function that converts a value in one monetary currency to another monetary currency. Such a function is not available within the set of built-in routines. This function can be created however as a user-defined SQL scalar function. Once created this function can be referenced wherever scalar functions are supported within an SQL statement.
Another user might require a more complex function that sends an e-mail whenever a change is made to a particular column in a table. Such a function is not available within the set of built-in routines. This function can be created however as a user-defined external procedure with a C programming language implementation. Once created, this procedure can be referenced wherever procedures are supported, including from within triggers.
These examples demonstrate how easily you can extend the SQL language by creating user-defined routines.