Differences between user defined functions and procedures
There are several differences between user defined functions and procedures: 1. Function must return a value, whereas it's not necessary for procedure to return any value. 2. Function returns only one value, whereas procedure can return multiple values. 3. Function can be called by SQL statement like
SELECT full_name(first_name, last_name) FROM students
, whereas procedure can not be called in SQL queries. 4. Function uses
RETURN
keyword to return value, whereas procedure does not need the keyword to return values. 5. Function parameter can only be
IN
type, whereas procedure parameters can have one of the three types:
IN
,
OUT
or
IN OUT
6. Function usually is used in expressions like built-in functions or variables whereas procedure is usually used to execute some business logic
by Valeri Tandilashvili
4 years ago
MySQL
Functions
Procedures
1
Pro tip: use ```triple backticks around text``` to write in code fences