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