存储过程,函数和例程之间有什么区别? [英] What's the differences between stored procedures, functions and routines?

查看:89
本文介绍了存储过程,函数和例程之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆