the first step, you should create a table in db2 database
for example :
open a sql editor in the db2 envionment .and then
create table test (name varchar(20),address varchar(200));
so , you run this sql ,the table will be created by you .
the second step : you open a command window with db2cmd command ;
the next screen, you type the following command ,it will help create your procedure .
db2 td@ -vf sql_pre.txt (
Attention, the text file include your real procedure script ),after the article , I will give you the file .
dont worry about .
when the command return a success message , you can find a new procedrue which you create just .
the third step : call your procedrue ;
call db2admin.testprc.
if good luck you will see your result .
Append file :
create procedure db2admin.testPrc()
dynamic result sets 1
p1: begin
declare stmt varchar(500);
dynamic result sets 1
p1: begin
declare stmt varchar(500);
declare c cursor with return for select * from db2admin.marklist;
open c;
end p1 @
open c;
end p1 @
注意2点
以 @结尾
用 P1 块来描述