Brief introduction:
(1) Definition:
Commonly used or very complex work, pre-written with SQL statements and stored with a specified name, then to call the database to provide the same functionality as a defined stored procedure, only call execute to automatically complete the command.
A stored procedure (Stored Procedure) is a set of SQL statements that are compiled and stored in a database in order to accomplish a specific function. The user executes it by specifying the name of the stored procedure and giving the parameter (if the stored procedure has parameters). Stored procedures are an important object in a database, and any well-designed database application should use stored procedures.
(2) Advantages:
1. The stored procedure is compiled only at creation time, and each subsequent execution of the stored procedure does not need to be recompiled, while the general SQL statements are compiled once per execution, so using stored procedures can increase the speed of the database execution.
2. When complex operations are performed on a database, such as when multiple tables are update,insert,query,delete, this complex operation can be encapsulated with stored procedures and used in conjunction with the transactional processing provided by the database.
3. Stored procedures can be reused to reduce the workload of database developers
4. High security, can be set only a certain user has the right to use the specified stored procedure
Stored Procedures (Stored Procedure)