Determining what functional type of routine to use
Procedures, functions, and methods provide different functional routine and feature support. Determining what routine type to use or implement will determine where and how you can reference and invoke the routine functionality, influence what routine implementations you can use, and can influence what types of functionality your routine can contain.
Before you begin
Determining what routine type is best suited to your needs before beginning to implement it will save you time and possible frustration later.
Read about the functional types of routines to learn about their characteristics.Procedure
To determine whether to use a procedure, function, or method, do the following:
Results
In general functional and SQL requirements motivate the choice of what functional type of routine to implement. However, there are cases where it is possible to create logically equivalent routines with different functional types. For example, it is possible to rewrite most basic procedures that return a single result-set as a table function. You can also easily rewrite basic procedures with only a single output parameter as scalar functions.
What to do next
Once you have determined what functional type of routine to use, you might be interested in learning more about routine implementations or in determining what routine implementation to use.