1. 定义变量
declare n integer; //定义单个变量 //定义多个变量 DECLARE n integer; mm integer;
2. 赋值
n:=12; mm:=100;
for 语句
DECLARE n integer; mm integer; begin n:=12; mm:=100; for n in 10..1000 loop insert into tab_test (Pk,TESTE) VALUES (cast(n as varchar(23)),cast(n as varchar(25))); end loop; commit; end;
while 语句
declare n integer; mm integer; begin n:=12; mm:=500000; while n<mm loop insert into V_k2(CONTACT_ADDRESS,EMPLOYEE_CODE) values('user'||cast(n as varchar(50))||'@fescoadecco.com',cast(n as varchar(20))); n:=n+1; end loop; commit; end;