Senin, 01 April 2013

Contoh Syntax PL/SQL Procedure Bilangan Fibonacci


create or replace procedure fb(t in number) as
f0 number := 0;
f1 number := 1;
tmp number;
tmp3 number := 1;
tmp4 number := 0;
begin
WHILE tmp3 <= t+1 LOOP
    if f0>0 then
    dbms_output.put(f0||'  ');
    end if;
    tmp4:=tmp4+1;
     if tmp3=tmp4 then
     tmp3:=tmp3+1;
     tmp4:=1;
     dbms_output.NEW_LINE;
        end if;
        tmp := f1;
        f1 := f0+f1; 
        f0 := tmp; 
END LOOP;
end;
/

mengcompile: set serveroutput on;
execute fb(3);

0 komentar:

Posting Komentar

 

in4matica Generasi Biru Template by Ipietoon Cute Blog Design