A function is a set of tasks so that a piece of code can take care for the functionality of a database. The main difference between a function procedure and a sub procedure is that a function can return a value.
A function is created like a sub procedure with a few more rules.
To implement a function, remember that it is supposed to return a value. In the body of the function, describe what it is supposed to do. to return the right value, assign the desired value to the name of the function. Here is an example: