Description: For math users: produce the numbers of the Fibonaci series.
Comment: (none)
Language: PL/SQL Highlight Mode: PLSQL Last Modified: February 27th, 2009
CREATEORREPLACEPROCEDURE fib AS
fib_var VARCHAR2(1000);
i INTEGER;
fib_num NUMBER;
fib_num1 NUMBER;
fib_num2 NUMBER;
start_var NUMBER;
count_var NUMBER;BEGIN/*
select 50 - to_number(to_char(sysdate, 'DD'))
into start_var
from dual;
*/
start_var :=9;
count_var :=11;DELETEFROM jwc_fib;
fib_num1 :=1;
fib_num2 :=2;
fib_var :=TO_CHAR(fib_num1)||to_char(fib_num2);FOR i IN 1..25LOOP
fib_num := fib_num1+fib_num2;
fib_var := fib_var ||TO_CHAR(fib_num);
fib_num1 := fib_num2;
fib_num2 := fib_num;ENDLOOP;INSERTINTO jwc_fib field1
--values (substr(fib_var,start_var,count_var));VALUES(fib_var);-- this will output 25 iterations of the fibonaci seriesCOMMIT;--could have the fib_nums (instead of the start and count vars) as input based on month, day, etc.END fib;
SQL University.net courses meet the most demanding needs of the business world for advanced education
in a cost-effective manner. SQL University.net courses are available immediately for IT professionals
and can be taken without disruption of your workplace schedule or processes.
Compared to traditional travel-based training, SQL University.net saves time and valuable corporate
resources, allowing companies to do more with less. That's our mission, and that's what we deliver.