存储过程,函数和例程之间有什么区别? [英] What's the differences between stored procedures, functions and routines?
问题描述
在MySQL数据库上下文中,这3个术语有什么区别?
In MySQL database context, what is the difference among these 3 terms:
- 存储过程
- 存储的函数
- 存储的例程
- stored procedure
- stored function
- stored routine
还有像那些日期时间函数之类的内置函数(例如WEEKDAY()
等)被认为是什么?
Also the build-in functions like those date time functions (e.g. WEEKDAY()
etc) are considered as what?
推荐答案
Google是您的朋友. "mysql例程函数过程"的第一个匹配项是: http://dev.mysql.com/doc/refman/5.0/zh-CN/stored-routines-syntax.html
Google is your friend. The first match for "mysql routine function procedure" is this: http://dev.mysql.com/doc/refman/5.0/en/stored-routines-syntax.html
快速摘要:
存储的例程可以是过程,也可以是函数.
A stored routine is either a procedure or a function.
使用CALL语句调用过程,并且只能使用输出变量传回值.
A procedure is invoked using a CALL statement and can only pass back values using output variables.
一个函数可以像其他任何函数一样从语句内部调用,并且可以返回标量值.
A function can be called from inside a statement just like any other function and can return a scalar value.
这篇关于存储过程,函数和例程之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!