Steps for creating and deleting a DB2 Stored Procedure

Source: Internet
Author: User

The following articles mainly introduce the DB2 stored procedure. The following articles will introduce you to the relevant DB2 Stored Procedure knowledge. If you are curious about the DB2 Stored Procedure technology, the following articles will unveil its mysteries. Rule 20: The daily transaction amount of a merchant exceeds the daily average ratio of the previous week/month.

IN_TXN_DT: Transaction date, in the format of 'yyyy-MM-dd'

Delete stored procedure

 
 
  1. DROP PROCEDURE MI_PROJECT_RULE20;  

Create a DB2 Stored Procedure

 
 
  1. CREATE PROCEDURE MI_PROJECT_RULE20  
  2. (IN IN_TXN_DT DATE)  
  3. LANGUAGE SQL  
  4. BEGIN  
  5. BEGIN 

Clear transaction details for the current day to prevent repeated data

 
 
  1. DELETE FROM T05_DUBIOUS_TXN_SUM WHERE D_TXN_STAT_ID IN (SELECT D_TXN_STAT_ID FROM T05_DUBIOUS_TXN_STAT WHERE MI_ID=20 AND TXN_DT=IN_TXN_DT);  
  2. COMMIT; 

Clear summary data for the current day

 
 
  1. DELETE FROM T05_DUBIOUS_TXN_STAT WHERE MI_ID=20 AND TXN_DT=IN_TXN_DT;  
  2. COMMIT; 

Create a session temporary table

 
 
  1. DECLARE GLOBAL TEMPORARY TABLE T05_TMP_MI   

The above content is an introduction to some of the DB2 stored procedures. I hope you will get something better.

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.