Forward Declarations : Create Procedure « Function Procedure Packages « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> DECLARE
  2    v_TempVal BINARY_INTEGER := 5;
  3
  4    -- Forward declaration of procedure B.
  5    PROCEDURE B(p_Counter IN OUT BINARY_INTEGER);
  6
  7    PROCEDURE A(p_Counter IN OUT BINARY_INTEGER) IS
  8    BEGIN
  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      p_Counter := p_Counter - 1;
 18      A(p_Counter);
 19    END B;
 20  BEGIN
 21    B(v_TempVal);
 22  END;
 23  /

PL/SQL procedure successfully completed.

SQL>
SQL>








27.6.Create Procedure
27.6.1.Creating a procedure
27.6.2.Creating a Stored Procedure for table update
27.6.3.Call a trigger in procedure
27.6.4.Re-creating a Procedure By Using OR REPLACE
27.6.5.Exceptions in Subprograms
27.6.6.Forward Declarations
27.6.7.Using stored functions in SQL statements, function getName
27.6.8.Create procedure for AUTHID CURRENT_USER