Deep understanding of DB2 stored procedures

Source: Internet
Author: User

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

Related Article

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.