Home  >  Article  >  Database  >  What is sql stored procedure

What is sql stored procedure

清浅
清浅Original
2019-05-08 14:07:3823883browse

A stored procedure refers to an encapsulated procedure consisting of some SQL statements and control statements. It resides in the database and can be called by client applications. The user specifies the name of the stored procedure and gives Parameters to call to execute it, or it can be called from another procedure or trigger.

What is sql stored procedure

sql stored procedure

The stored procedure refers to an encapsulated form composed of some SQL statements and control statements. The procedure, which resides in the database, can be called by the client application. The user can call and execute it by specifying the name of the stored procedure and giving parameters (if the stored procedure has parameters). It can also be called from another procedure or trigger. device call.

Stored procedures are programmable functions that are created and saved in the database and can be composed of SQL statements and control structures. Stored procedures are useful when you want to perform the same function on different applications or platforms, or when you want to encapsulate specific functionality. Stored procedures in a database can be seen as a simulation of the object-oriented approach in programming, which allows control of how data is accessed.

Types of stored procedures

According to the different return value types, we can divide stored procedures into three categories: stored procedures that return recordsets, and stored procedures that return values. (also known as scalar stored procedures), and behavioral stored procedures.

1. A stored procedure that returns a record set: its execution result is a record set. A typical example is to retrieve records that meet one or several conditions from the database;

2 . Stored procedures that return values: return a value after execution, such as executing a function or command with a return value in the database;

3. Behavioral stored procedures: only used to implement a certain function of the database , without returning a value, such as update and delete operations in the database.

The above is the detailed content of What is sql stored procedure. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn