What you generate is rightly called an "execution plan." Explain the plan is the command used to create and view the execution plan, as AUTOTRACE TRACEONLY does in your example.
By definition, an execution plan is for a single SQL statement. The PL / SQL block does not have an execution plan. If it contains one or more SQL statements, then each of them will have an execution plan.
One option is to manually extract the SQL statements from the PL / SQL code and use the process that you have already shown.
Another option is active SQL tracing, and then follow the procedure. This will create a trace file on the server that contains execution plans for all statements executed in the session. The track is in a rather crude form, so it is easiest to format it using the Oracle TKPROF tool; There are also various third-party tools that also process these trace files.
Dave costa
source share