How to call a procedure in a procedure
A SearchOracle.com reader asks, "How do I call another procedure p2 from p1?"
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.
Dig Deeper on Oracle database administration
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.
Meet all of our Oracle Database / Applications experts
View all Oracle Database / Applications questions and answers
Start the conversation
0 comments