我向给数据库中造上一批数据,写了存储过程,但WHILE语句总是报错,寻找大侠级解决办法。
1、语句:
create or replace procedure insertDate as
BEGIN
DECLARE monthly_value number;
number monthly_value:= 0;
while monthly_value < 100000 LOOP insert into student values(monthly_value,monthly_value);
commit;
monthly_valuei:=monthly_value + 1;
dbms_output.put_line(i);
END LOOP;
END;
2、错误信息如下:PROCEDURE WNJW.INSERTDATE 编译错误错误:PLS-00103: 出现符号 "<"在需要下列之一时:
:= . ( @ % ; not null range
default character
行:6
文本:while monthly_value < 100000 LOOP错误:提示: Variable 'while' 已被声明但从来没有被用于 'insertDate'
行:6
文本:while monthly_value < 100000 LOOP错误:提示: Variable 'monthly_valuei' 已被声明但从来没有被用于 'insertDate'
行:9
文本:monthly_valuei:=monthly_value + 1;
1、语句:
create or replace procedure insertDate as
BEGIN
DECLARE monthly_value number;
number monthly_value:= 0;
while monthly_value < 100000 LOOP insert into student values(monthly_value,monthly_value);
commit;
monthly_valuei:=monthly_value + 1;
dbms_output.put_line(i);
END LOOP;
END;
2、错误信息如下:PROCEDURE WNJW.INSERTDATE 编译错误错误:PLS-00103: 出现符号 "<"在需要下列之一时:
:= . ( @ % ; not null range
default character
行:6
文本:while monthly_value < 100000 LOOP错误:提示: Variable 'while' 已被声明但从来没有被用于 'insertDate'
行:6
文本:while monthly_value < 100000 LOOP错误:提示: Variable 'monthly_valuei' 已被声明但从来没有被用于 'insertDate'
行:9
文本:monthly_valuei:=monthly_value + 1;
这样就好了啊:
create or replace procedure insertdate as
monthly_value number:=0;
begin
while monthly_value<10
loop
monthly_value:=monthly_value+1;
insert into b values('7','123');
dbms_output.put_line(monthly_value);
end loop;
commit;
end;
monthly_value number:=0;
begin
while monthly_value<100000
loop
monthly_value:=monthly_value+1;
insert into student values(monthly_value,monthly_value);
dbms_output.put_line(monthly_value);
end loop;
commit;
end;