Encountered the symbol “end-of-file” when expecting one of the following

后端 未结 1 1068
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 04:40

I\'m trying to print Fibonacci series in plsql

this is the procedure

CREATE OR REPLACE PROCEDURE fibos(n IN number) IS
DECLARE  
first number := 0; 
seco         


        
相关标签:
1条回答
  • 2021-01-29 05:23

    Remove DECLARE in the CREATE PROCEDURE statement and add a END; to your anonymous block calling it.

    CREATE OR REPLACE PROCEDURE fibos(n IN number) IS
    first number := 0; 
    second number := 1; 
    temp number;   
    i number; 
    BEGIN
    dbms_output.put_line('Series:'); 
    dbms_output.put_line(first); 
    dbms_output.put_line(second); 
    for i in 2..n 
    loop 
    temp:=first+second; 
    first := second; 
    second := temp; 
    dbms_output.put_line(temp); 
    END loop; 
    END; 
    /
    

    DECLARE
    a number := &a;
    BEGIN
    fibos(a);
    END;
    /
    

    db<>fiddle

    0 讨论(0)
提交回复
热议问题