Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Now I have a different question. Let me explain you step by step
(1) Presently the query is running from a middleware without any hint. And making code changes (adding hint) in the middleware requires time. The query has 6 bind variables defined. I located the query in the database with sqlid XXXX.
(2) I am running the same query from sqlplus adding a hint and defining those bind variables like below
(3) I got a SQLID, e.g YYYY for the query I ran above from sqlplus.
(1) If I capture a baseline using the sqlid (YYYY) above, can I use that plan for the query coming from middleware?Hash_plan is different though.
(2) If not, how to create a baseline for the query coming from middleware with a HINT?