1  declare
  2  i integer;
  3  s integer;
  4  begin
  5  i:=0;
  6  s:=0;
  7  for i in 1..10 loop
  8     s:=s+i*i;
  9  end loop;
 10  dbms_output.put_line('Sum = '||s);
 11* end;
SQL> /
Sum = 385

PL/SQL procedure successfully completed.
Advertisements