最近有朋友问起SP的解释,我说这个是SQL的基础概念之一,定义应该很清楚,网上随即可查。他说他们公司一搞技术的领导说12年后SP的实现方法有变化,原来的定义解释太单一。数据库
好吧,我在网上也没查到具体什么变化,但想一想数据库实现,几个主流的大公司在底层都有不一样的实现方式,MS SQL Server/ MySQL/ Oracle, 可能这些数据库对SP的实现方法不同,可是从概念定义上应该没变化。express
搜了搜wikipedia上的定义,再来看看SP的解释:app
A stored procedure is a subroutine available to applications that access a relational database system. A stored procedure (sometimes called a proc, sproc,StoPro, StoredProc, StoreProc, sp or SP) is actually stored in the database data dictionary.ui
Typical use for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures can consolidate and centralize logic that was originally implemented in applications. Extensive or complex processing that requires execution of several SQLstatements is moved into stored procedures, and all applications call the procedures. One can use nested stored procedures by executing one stored procedure from within another.spa
Stored procedures are similar to user-defined functions (UDFs). The major difference is that UDFs can be used like any other expression within SQL statements, whereas stored procedures must be invoked using the Call statement翻译
我的翻译:orm
存储过程(SP)是可供应用调用来访问关系数据库的子程序。SP通常存储在数据库的数据字典里。
ip典型应用包括数据校验(集成在数据库中)或数据控制。更进一步的,SP能够巩固和集中最初在应用程序中实现的逻辑。须要执行多条SQL语句的多操做或复杂操做被移动到SP中,全部的应用程序均可以调用这个procedure。get
说到数据库变化,近几年新起非关系型(NoSQL)数据库,查了一下NoSQL也有本身的存储过程。其实SP说白了就是一段放在数据库端的“小”程序,经过此数据库的语法语言就能调用,实现必定的功能。若是说定义有变化的话,能够把这段加上。it