我是在PL/SQL Devloper下面写的这段代码,但是报错“必须申明标识符 hundreds_counter”,我申明了呀,
请问哪里错了,谢谢
set echo on
set serveroutput on
--Count up by hundreds until we get an error.
declare
-- Note that with a scale of -2 this variable can only
--hold values like 100,200,300...up to 900.
hundreds_counter number(1,-2);
begin
hundreds_counter:=100;
loop
dbms_output.put_line(hundreds_counter);
hundreds_counter:=hundreds_counter+100;
end loop;
exception
when others then
dbms_output.put_line('That is as high as we can go.');
end;
请问哪里错了,谢谢
set echo on
set serveroutput on
--Count up by hundreds until we get an error.
declare
-- Note that with a scale of -2 this variable can only
--hold values like 100,200,300...up to 900.
hundreds_counter number(1,-2);
begin
hundreds_counter:=100;
loop
dbms_output.put_line(hundreds_counter);
hundreds_counter:=hundreds_counter+100;
end loop;
exception
when others then
dbms_output.put_line('That is as high as we can go.');
end;
2 -- Note that with a scale of -2 this variable can only
3 --hold values like 100,200,300...up to 900.
4 hundreds_counter number(1,-2);
5 begin
6 hundreds_counter:=100;
7 loop
8 dbms_output.put_line(hundreds_counter);
9 hundreds_counter:=hundreds_counter+100;
10 end loop;
11 exception
12 when others then
13 dbms_output.put_line('That is as high as we can go.');
14 end;
15 /
PL/SQL procedure successfully completed
SQL> set serveroutput on;
SQL> /
100
200
300
400
500
600
700
800
900
That is as high as we can go.
PL/SQL procedure successfully completed
SQL>
2 hundreds_counter number(1,-2);
3 begin
4 hundreds_counter:=100;
5 loop
6 dbms_output.put_line(hundreds_counter);
7 hundreds_counter:=hundreds_counter+100;
8 end loop;
9 exception
10 when others then
11 dbms_output.put_line('That is as high as we can go.');
12 end;
13 /
100
200
300
400
500
600
700
800
900
That is as high as we can go.
PL/SQL procedure successfully completed