A forward declaration. : Procedure Definition « Stored Procedure Function « Oracle PL / SQL






A forward declaration.

    
SQL>
SQL> set serveroutput on
SQL>
SQL> DECLARE
  2    v_TempVal BINARY_INTEGER := 5;
  3
  4    PROCEDURE B(p_Counter IN OUT BINARY_INTEGER);
  5
  6    PROCEDURE A(p_Counter IN OUT BINARY_INTEGER) IS
  7    BEGIN
  8      DBMS_OUTPUT.PUT_LINE('A(' || p_Counter || ')');
  9      IF p_Counter > 0 THEN
 10        B(p_Counter);
 11        p_Counter := p_Counter - 1;
 12      END IF;
 13    END A;
 14
 15    PROCEDURE B(p_Counter IN OUT BINARY_INTEGER) IS
 16    BEGIN
 17      DBMS_OUTPUT.PUT_LINE('B(' || p_Counter || ')');
 18      p_Counter := p_Counter - 1;
 19      A(p_Counter);
 20    END B;
 21  BEGIN
 22    B(v_TempVal);
 23  END;
 24  /
B(5)
A(4)
B(4)
A(3)
B(3)
A(2)
B(2)
A(1)
B(1)
A(0)

PL/SQL procedure successfully completed.

SQL>
SQL>

   
    
    
  








Related examples in the same category

1.Creat an empty procedure
2.replace a procedure
3.Create a stored procedure and how to call it.
4.Define procedure to insert data
5.Define and call procedure
6.Create procedure with authid
7.Create a stored procedure with authid
8.Mutually exclusive local subprograms.
9.Inner procedure
10.Save calculation result to a table in procedure
11.exception throwed out of the procedure
12.AUTHID clause in a CREATE PROCEDURE statement indicates that this procedure is being created with user's or invoker's rights
13.Increase gift price
14.A local subprogram within a stored procedure
15.Overloaded local procedures: number and varchar2
16.Using all the default values
17.Forward Referencing
18.Mark procedure with authid current_user
19.Reference package variable in a procedure
20.Only manager can change the password