{"id":1965,"date":"2012-03-06T15:22:34","date_gmt":"2012-03-06T20:22:34","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=1965"},"modified":"2012-03-06T15:22:34","modified_gmt":"2012-03-06T20:22:34","slug":"sql-patch","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2012\/03\/06\/sql-patch\/","title":{"rendered":"SQL Patch"},"content":{"rendered":"<p>Oracle comes up with some cool tricks for fixing poorly performing SQL, especially code to which you have no direct access.  If you absolutely know a given hint will always work, the <a href=https:\/\/blogs.oracle.com\/optimizer\/entry\/how_can_i_hint_a target=_blank>Oracle optimizer blog <\/a> recently posted a method for &#8220;sticking&#8221; a hint into the statement when it is executed.  I wonder how long the post will be up, as it is undocumented behaviour.  Test and use at your own risk.<\/p>\n<pre lang=\"plsql\" line=\"1\">\r\ndeclare\r\n  l_sqlid varchar2(100) := '&sql_id';\r\n  l_sqltext clob;\r\nbegin\r\n  select sql_fulltext into l_sqltext from v$sql where sql_id = l_sqlid;\r\n  dbms_sqldiag_internal.i_create_patch(sql_text => l_clob, hint_text => 'BIND_AWARE',name => 'test_patch');\r\nend;\r\n\/\r\n<\/pre>\n<p>The next time you execute this SQL, it should have a version with &#8216;Y&#8217; for the IS_BIND_AWARE element in GV$SQL.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oracle comes up with some cool tricks for fixing poorly performing SQL, especially code to which you have no direct access. If you absolutely know a given hint will always work, the Oracle optimizer blog recently posted a method for&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2012\/03\/06\/sql-patch\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,22],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1965"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1965"}],"version-history":[{"count":4,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1965\/revisions"}],"predecessor-version":[{"id":1969,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1965\/revisions\/1969"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1965"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}