CREATE PROCEDURE p1 (x IN NUMBER, y OUT VARCHAR2) AS BEGIN DBMS_OUTPUT.PUT_LINE('x='||x); y:=x; p2(y); END; /
In the same procedure above, I can obtain the value of "x" at runtime simply by referring to it in my code. My call to DBMS_OUTPUT.PUT_LINE just references the x variable. Similarly, I assign the value of x to the variable y. Since 'y' is defined as an output variable to the procedure, the calling program can see the changes to this variable.
Calling a procedure in a procedure is as simple as stating the procedure's name and supplying any necessary arguments. In my example above, I call procedure P2 and pass the variable "y" to it.
This was first published in January 2008