Q

Calling procedure inside another procedure in anonymous block

I have a procedure p1 which holds another procedure p2. I want to call this p2 procedure in an anonymous block.

I have a procedure p1 which holds another procedure p2. I want to call this p2 procedure in an anonymous block. Note: p2 is inside p1. How can I call this p2 proc outside the p1 procedure? Thanks in advance.
Due to the scope involved here, you cannot call procedure P2 directly. The P2 proc is known only to the P1 proc therefore it can only be called by P1. I would suggest you create a package and make both procedures parts of the package. Then you will be able to call either procedure directly. If you do not want to use a package, then use the DBMS_METADATA.GET_DDL procedure to get the source code for the P1 proc. Use this output to create your own P2 proc.
This was first published in July 2007

Dig deeper on Using Oracle PL-SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close