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

PL/SQL procedure successfully completed.
Advertisements