Database stored procedures (stored procedure) overview

Source: Internet
Author: User

A stored procedure (Stored Procedure) is a large database system in which a set of SQL statements to complete a specific function is compiled and stored in a database, and the user executes it by specifying the name of the stored procedure and giving the parameter (if the stored procedure has parameters).


The main difference between it and a user-defined function is that

A stored procedure is a collection of SQL statements that define a series of tasks that involve a particular table or other object, and the user can invoke the stored procedure. A function is a method that the database has defined that takes parameters and returns some type of value, and does not involve a specific user table.

Second said:

Functions (UDFs) can be applied like other expressions, and stored procedures can only be invoked through call or execute

Call procedure (...)

EXECUTE preocedure (...)


Three said:

A function is a subroutine used to do some calculations. Scalar functions return only one value (or NULL), the table function returns the relational table for several rows, and a number of column functions in each row must return a value (using the keyword), and the stored procedure does not enforce the requirement. Stored procedures can use return keywords, but do not require return value functions to be used in SELECT statements as long as they do not manipulate data. Stored procedures cannot be used in slelect statements. Functions have only in parameters, and stored procedures can have out or inout parameter stored procedures can return multiple values through an out parameter or return nothing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.