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
- CREATE PROCEDURE S2MS.ADDRWDp2 (in inid int,in idend int )
-
- LANGUAGE SQL
-
- NOT DETERMINISTIC
- CALLED ON NULL INPUT
- MODIFIES SQL DATA
- INHERIT SPECIAL REGISTERS
- begin
- DECLARE rwdid decimal(10,0);
- declare bh varchar(100);
- set rwdid=inid;
- set bh = 'a';
- while rwdid<idend do
- set bh = 'a'||char(rwdid);
- insert into jtrwd
- (id,gclb_id,sjdw_id,bh,gcbh,gcmc,wtrq,lxr)
- values(rwdid,1,1,bh,char(rwdid),'gc',current timestamp,'d');
- set rwdidrwdid=rwdid+1;
- end while;
- 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.