declare f0 integer := 0; f1 integer := 1; f2 integer := 0; i integer := 1; upton integer := &upton; begin while (i <= upton) loop if (i = 1) then dbms_output.put_line(f0); elsif (i = 2) then dbms_output.put_line(f1); else f2 := f0 + f1; dbms_output.put_line(f2); f0 := f1; f1 := f2; end if; i := i+1; end loop; end; /
first you should set the server output on. To do so write: SQL> set serveroutput on;
Enter value for upton: 6 old 6: upton integer := &upton; new 6: upton integer := 6; 0 1 1 2 3 5 PL/SQL procedure successfully completed.