What code is used for writing DB2 stored procedures?

Source: Internet
Author: User

The following articles mainly describe the DB2 Stored Procedure writing process. This article mainly uses the actual application code to implement the DB2 stored procedure to lead to the correct operation process, the following is a detailed description of the main content of the article. I hope you will have a better understanding of it after browsing.

Write

 
 
  1. CREATE PROCEDURE S2MS.ADDRWDp2 (in inid int,in idend int )   
  2.  
  3. LANGUAGE SQL   
  4.  
  5. NOT DETERMINISTIC   
  6. CALLED ON NULL INPUT   
  7. MODIFIES SQL DATA   
  8. INHERIT SPECIAL REGISTERS   
  9. begin   
  10. DECLARE rwdid decimal(10,0);   
  11. declare bh varchar(100);   
  12. set rwdid=inid;   
  13. set bh = 'a';   
  14. while rwdid<idend do   
  15. set bh = 'a'||char(rwdid);   
  16. insert into jtrwd   
  17. (id,gclb_id,sjdw_id,bh,gcbh,gcmc,wtrq,lxr)   
  18. values(rwdid,1,1,bh,char(rwdid),'gc',current timestamp,'d');   
  19. set rwdidrwdid=rwdid+1;   
  20. end while;   
  21. end;>   

Copy code

The above content is an introduction to the preparation of the DB2 stored procedure. I hope you will find some gains.

The above content is the description of, hoping to help you in this regard.

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.