Defined:
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. A stored procedure is a process written by flow control and SQL statements that are compiled and optimized to be stored in the database server as long as the application is invoked. In Oracle, several linked processes can be grouped together to form a package.
Advantages:
1. ( precompiled ) stored procedures are compiled only at creation time, and each subsequent execution of the stored procedure does not need to be recompiled, and the general SQL statements are compiled once per execution, so using stored procedures increases the speed of the database execution.
2. ( transactional ) when complex operations are performed on a database, such as when you update, Insert, Query, and delete multiple tables, this complex operation can be encapsulated with stored procedures and used in conjunction with the transactional processing provided by the database.
3. ( repetitive ) stored procedures can be reused to reduce the workload of database developers.
4. ( security ) high security, can be set only one user has the right to use the specified stored procedures.
comparison of stored procedures and functions