I have a stored procedure that consists of a single select query used to insert into another table based on some minor math that is done to the arguments in the procedure. Can I generate the plan used for this query by referencing the procedure somehow, or do I have to copy and paste the query and create bind variables for the input parameters?
Share
Use SQL Trace and TKPROF. For example, open SQL*Plus, and then issue the following code:-
Once this has been done, go look in your database’s UDUMP directory for a TRC file with ‘something-unique’ in the filename. Format this TRC file with TKPROF, and then open the formatted file and search for the string ‘right-before-my-sp’. The SQL command issued by your stored procedure should be shortly after this section, and immediately under that SQL statement will be the plan for the SQL statement.
Edit: For the purposes of full disclosure, I should thank all those who gave me answers on this thread last week that helped me learn how to do this.