The DB2 stored procedure is an important part of the DB2 database. Let's take a look at the concept of the DB2 stored procedure and hope to help you.
What is a DB2 stored procedure?
Definition:
Store common or complex tasks in advance with SQL statements and a specified name, to enable the database to provide services with the same functions as the predefined DB2 stored procedure, you only need to call execute to automatically complete the command.
Someone may ask: So DB2 stored procedures are just a bunch of SQL statements?
So what is the difference between DB2 stored procedures and general SQL statements?
Advantages of the DB2 stored procedure:
1. the DB2 stored procedure is compiled only when it is created. You do not need to re-compile every time you execute the DB2 stored procedure. Generally, the SQL statement is compiled every time it is executed, therefore, using DB2 stored procedures can speed up database execution.
2. when performing complex operations on the database (for example, performing Update, Insert, Query, and Delete operations on multiple tables ), this complex operation can be encapsulated with the DB2 stored procedure and used together with the transaction processing provided by the database.
3. the DB2 stored procedure can be reused to reduce the workload of database developers.
4. High security. You can set that only one user has the right to use the specified DB2 stored procedure.
Types of DB2 stored procedures:
1. System DB2 stored procedure: starts with sp _, which is used to set the system and obtain information. related management work. For example, sp_help is used to obtain information about the specified object.
2. Extended DB2 stored procedures start with XP _ and are used to call functions provided by the operating system, such as exec master .. xp_mongoshell 'Ping 172.31.193.111 '.
3. the user-defined DB2 stored procedure, which we refer to as the DB2 stored procedure.
How to create a temporary DB2 table
DB2 connection Server Configuration
Solution to db2 tablespace lock
How to Create a tablespace in DB2
Install DB2 in linux