View SQL statement execution in Stored Procedures in DB2 (1)

Source: Internet
Author: User

This article describes how to view the execution of SQL statements in a stored procedure in a DB2 database. You can use snapshot to view dynamic SQL statements and event monitor to view the execution of SQL statements in stored procedures. If you are interested in this, take a look at it. I believe it will help you.

You can use snapshot to view dynamic SQL statements and event monitor to view the execution of SQL statements in the stored procedure.
However, event monitor records the package id and Section id instead of the SQL statement.
Query the table based on the package id and Section id to obtain the original SQL statement.

Example:
(1) create a stored procedure
Create procedure sales_status
(In quota integer)
Dynamic result sets 2
Language SQL
Begin
Declare SQLSTATE char (5 );

Declare rs cursor with return
Select sales_person, sum (sales) as total_sales
From sales
Group by sales_person
Having sum (sales)> quota;

Open rs;

Insert into tt1 values (1), (2), (3), (4), (5 );

End


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.