Mega Code Archive

 
Categories / Oracle PLSQL / PL SQL
 

Packages allows forward references, thus opening the possibilities for recursion

SQL> SQL> SQL> create package RECURSION is   2    procedure A(p number);   3    procedure B(p number);   4  end;   5  / SQL> SQL> SQL> create or replace   2  package body RECURSION is   3   4  procedure A(p number) is   5  begin   6    if p < 5 then   7       B(p+1);   8    end if;   9  end;  10  11  procedure B(p number) is  12  begin  13    if p < 5 then  14       A(p+1);  15    end if;  16  end;  17  18  end;  19  / Package body created. SQL>