<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Getting plans for statements inside a function or procedure in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818101#M4848944</link>
    <description>&lt;P&gt;This can be used to get the graphical plan from within a stored procedure. Although, if the statement is executed multiple times, you may want to insert the graphical plan into a temporary table before writing to disk.&lt;/P&gt;
&lt;P&gt;But, with the LogExpensiveQueries feature, you should be able to get by without modifying the stored procedure or function. You can specify a minimum cost for queries as well as RememberLastPlan and the database server will output the plans accordingly.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2012 11:25:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-01-24T11:25:06Z</dc:date>
    <item>
      <title>Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaq-p/13818096</link>
      <description>&lt;P&gt;I have been profiling a number of functions and procedures and this has highlighted a big difference (in the wrong direction, unfortunately) in performance of some individual statements within a number of functions after moving from v10.0.1 to 12.0.1.&lt;/P&gt;
&lt;P&gt;Some of these statements are not straight selects or updates, but are in the form of a Watcom IF connstruct eg:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;if&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VacID&lt;/SPAN&gt; &lt;SPAN class="k"&gt;is&lt;/SPAN&gt; &lt;SPAN class="k"&gt;not&lt;/SPAN&gt; &lt;SPAN class="k"&gt;null&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="k"&gt;exists&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="k"&gt;select&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="k"&gt;from&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt; &lt;SPAN class="k"&gt;where&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;VacancyID&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VacID&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;PersonID&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;persid&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;status&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;'.'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;or&lt;/SPAN&gt; &lt;SPAN class="k"&gt;exists&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="k"&gt;select&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="k"&gt;from&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt; &lt;SPAN class="k"&gt;where&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;VacancyID&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VacID&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;PersonID&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;persid&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;noreemploy&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;))&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;return&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;'V'&lt;/SPAN&gt; &lt;SPAN class="k"&gt;end&lt;/SPAN&gt; &lt;SPAN class="n"&gt;if&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is just one of half a dozen similarly constructed statements in the function.&lt;/P&gt;
&lt;P&gt;The application profiling / tracing viewer treats everything between the initial BEGIN and the final END as a single statement, so no plan is available. Obviously I could rewrite the statement as something like &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="k"&gt;select&lt;/SPAN&gt; &lt;SPAN class="n"&gt;if&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VacID&lt;/SPAN&gt; &lt;SPAN class="k"&gt;is&lt;/SPAN&gt; &lt;SPAN class="k"&gt;not&lt;/SPAN&gt; &lt;SPAN class="k"&gt;null&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="k"&gt;exists&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="k"&gt;select&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="k"&gt;from&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt; &lt;SPAN class="k"&gt;where&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;VacancyID&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VacID&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;PersonID&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;persid&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;status&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;'.'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;or&lt;/SPAN&gt; &lt;SPAN class="k"&gt;exists&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="k"&gt;select&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="k"&gt;from&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt; &lt;SPAN class="k"&gt;where&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;VacancyID&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VacID&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;PersonID&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;persid&lt;/SPAN&gt; &lt;SPAN class="k"&gt;and&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Progress&lt;/SPAN&gt;&lt;SPAN class="p"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;noreemploy&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;))&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="k"&gt;else&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;0&lt;/SPAN&gt; &lt;SPAN class="n"&gt;endif&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;/BLOCKQUOTE&gt;
&lt;P&gt;then run that from isql and get a plan, but the query isn't quite the same and the context is quite different. &lt;/P&gt;
&lt;P&gt;Is there some way of getting the plans for such statements as the are actually executed, in the context of the function / procedure?&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;UPDATE&lt;/P&gt;
&lt;P&gt;Screen shot showing how the whole procedure is treated as a single statement, with no plan tab&lt;/P&gt;
&lt;P&gt; &lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Getting plans for statements inside a function or procedure"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/189577i21734A27B6649860/image-size/large?v=v2&amp;amp;px=999" role="button" title="Getting plans for statements inside a function or procedure" alt="Getting plans for statements inside a function or procedure" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2012 20:27:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaq-p/13818096</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2012-01-23T20:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818097#M4848940</link>
      <description>&lt;P&gt;There is some functionality to obtain these plans, Breck walks through it fairly well here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.risingroad.com/LogExpensiveQueries/LogExpensiveQueries.html"&gt;LogExpensiveQueries: A Little Bit Of Jasper In 9.0.2&lt;/A&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;Edit: You won't be able to diagnose exactly as in 9.0.2. In later versions, you'll be able to specify plan logging with -zr ALL or -zr ...+PLAN and direct the output with -zo&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;Of course, you can always wrap a query in a GRAPHICAL_PLAN call to get the necessary plan details from within the stored procedure or function:&lt;/P&gt;
&lt;P&gt;(i.e.)&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;CALL&lt;/SPAN&gt; &lt;SPAN class="n"&gt;xp_write_file&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="s"&gt;'my_plan.saplan'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt; &lt;SPAN class="sr"&gt;//&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;write&lt;/SPAN&gt; &lt;SPAN class="n"&gt;plan&lt;/SPAN&gt; &lt;SPAN class="n"&gt;to&lt;/SPAN&gt; &lt;SPAN class="n"&gt;a&lt;/SPAN&gt; &lt;SPAN class="n"&gt;file&lt;/SPAN&gt;
    &lt;SPAN class="n"&gt;GRAPHICAL_PLAN&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="s"&gt;'SELECT * FROM my_table'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;2&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="sr"&gt;//&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;2&lt;/SPAN&gt; &lt;SPAN class="k"&gt;for&lt;/SPAN&gt; &lt;SPAN class="n"&gt;detailed&lt;/SPAN&gt; &lt;SPAN class="n"&gt;statistics&lt;/SPAN&gt;
&lt;SPAN class="p"&gt;);&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;Documentation for GRAPHICAL_PLAN is at:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://dcx.sybase.com/index.html#1201/en/dbreference/graphical-plan-function.html"&gt;GRAPHICAL_PLAN function&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2012 19:35:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818097#M4848940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-23T19:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818100#M4848943</link>
      <description>&lt;P&gt;Thanks Tyson, I've been able to get plans for individual queries like the one in your example OK, but the problem comes with functions and procedures. &lt;/P&gt;
&lt;P&gt;What seems to happen there is that the whole procedure is treated as a unit, you can get statistics on how long it took to run and so on, and in the profile of the function you can get execution times of the individual statements that make up the procedure, but not plans for those statements.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 08:23:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818100#M4848943</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2012-01-24T08:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818101#M4848944</link>
      <description>&lt;P&gt;This can be used to get the graphical plan from within a stored procedure. Although, if the statement is executed multiple times, you may want to insert the graphical plan into a temporary table before writing to disk.&lt;/P&gt;
&lt;P&gt;But, with the LogExpensiveQueries feature, you should be able to get by without modifying the stored procedure or function. You can specify a minimum cost for queries as well as RememberLastPlan and the database server will output the plans accordingly.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 11:25:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818101#M4848944</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-24T11:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818102#M4848945</link>
      <description>&lt;P&gt;Thanks - I'll give that a go&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 12:07:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818102#M4848945</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2012-01-24T12:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818103#M4848946</link>
      <description>&lt;P&gt;FWIW, how does that 9.0.2 feature "LogExpensiveQueries" apply to current versions?&lt;/P&gt;
&lt;P&gt;With 10.0.1.4181 and 12.0.1.3389, both dbsrvX -zx and &lt;EM&gt;sa_server_option( 'LogExpensiveQueries', '1000');&lt;/EM&gt; are rejected as unknown options...&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 14:57:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818103#M4848946</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2012-01-24T14:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818104#M4848947</link>
      <description>&lt;P&gt;Good point! I've updated my answer.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 15:57:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818104#M4848947</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-24T15:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818105#M4848948</link>
      <description>&lt;P&gt;...Is &lt;EM&gt;DESPERATION_LEVEL&lt;/EM&gt; another coming knob? If so, what's the default, and can I set it on a per-user base?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2012 09:10:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818105#M4848948</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2012-01-25T09:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818106#M4848949</link>
      <description>&lt;P&gt;Yup that's the one - I'll just have to wait until 2014 - probably about the time one of the queries is going to finish!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2012 09:13:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818106#M4848949</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2012-01-25T09:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818107#M4848950</link>
      <description>&lt;P&gt;Are you &lt;EM&gt;sure&lt;/EM&gt; Database Tracing doesn't capture queries executed inside stored procedures?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2012 09:16:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818107#M4848950</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2012-01-25T09:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818108#M4848951</link>
      <description>&lt;P&gt;Part of the problem is that I don't really know how the IF statement is actually executed by the engine, ie is it recast as a SELECT, if so how etc? GRAPHICAL_PLAN() only takes SELECT, UPDATE and DELETE. &lt;/P&gt;
&lt;P&gt;I presume the thing to do would be to fetch the plan for the statement, in re-written form, BEFORE doing it for real, so that the plan isn't changed by running the actual statement?&lt;/P&gt;
&lt;P&gt;I rather like the LOG_EXPENSIVE_QUERY () idea - especially the way you would be able to have it in place at danger points and only invoke it when DESPERATION_LEVEL &amp;gt; (TOLERANCE_THRESHOLD - CAFFINE_QUOTIENT)&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2012 09:23:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818108#M4848951</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2012-01-25T09:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818109#M4848952</link>
      <description>&lt;P&gt;When I look at the detailed results you see the whole contents ie from BEGIN to END in the query column. Then when you click on that you see the contents in the query window with the overall timing but unlike a single statement there's no tab for the plan. I also looked to see if the individual statements are separately logged as well, but even after removing the filters I can't see them. &lt;/P&gt;
&lt;P&gt;That doesn't mean I'm not missing something though!&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;I'll post some screen shots when I get a moment&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2012 09:32:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818109#M4848952</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2012-01-25T09:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818110#M4848953</link>
      <description>&lt;P&gt;@All: The "Comment Text Removed" isn't the work of some nefarious censor, it's the result of me deleting my own comments without realizing replies had already been posted. Oh, well... whatever you imagine the missing comments to be is probably more interesting than the (now forgotten) reality &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2012 16:49:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818110#M4848953</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2012-01-25T16:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818111#M4848954</link>
      <description>&lt;P&gt;FWIW... I usually start with the stored procedure profiler to find which statements are actually slow, before digging deeper. Sometimes, it is all I use, if the flaw is obvious once the statement is highlighted... and it's a LOT easier to use than database tracing.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2012 16:53:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818111#M4848954</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2012-01-25T16:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818112#M4848955</link>
      <description>&lt;P&gt;Indeed, if only the tracing was as easy to use as the procedure profiling - turn on, look at results! That's how I got started down this route, then found I had to try to dig out the individual statements to why it had changed so much.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2012 19:35:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818112#M4848955</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2012-01-25T19:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818098#M4848941</link>
      <description>&lt;P&gt;I really don't understand, why only SA still don't has convenient mechanism for getting plans of any sql statements, without voodoo. Using Tracing/LogExpensiveQueries is not that thing that all wants today.
For some statement 1min is very fast, for another -1ms - very slow. So how to use LogExpensiveQueries in that case?
Please, just give us simple mechanism getting any plans without voodoo, like any other RDBMS has.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2012 07:45:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818098#M4848941</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-26T07:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818113#M4848956</link>
      <description>&lt;P&gt;"A simple mechanism for getting plans without voodoo" is a good description of a much needed improvement... too bad it lacks management appeal.&lt;/P&gt;
&lt;P&gt;Let's see... paradigm shift... adaptive server... unwired enterprise... &lt;/P&gt;
&lt;P&gt;...got it! cloud computing!&lt;/P&gt;
&lt;P&gt;How about "A simple mechanism for getting plans to improve cloud performance"?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2012 09:45:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818113#M4848956</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2012-01-26T09:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818114#M4848957</link>
      <description>&lt;P&gt;...what's the current value of the brandnew BUZZWORD_LEVEL option...?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2012 09:47:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818114#M4848957</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2012-01-26T09:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818115#M4848958</link>
      <description>&lt;P&gt;I'm sure it's essential for implementing IP6 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; or even better BIG DATA - the last one is even has the advantage of being true&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2012 09:54:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818115#M4848958</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2012-01-26T09:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting plans for statements inside a function or procedure</title>
      <link>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818099#M4848942</link>
      <description>&lt;P&gt;I see the[/an] issue now.&lt;/P&gt;
&lt;P&gt;The database server is not tracing the value of the expression tested in the IF statement. It's hard to say exactly why this is, but it could be that the EXISTS keyword is usually treated as a predicate for a query which creates a subquery. Since the IF statement isn't quite a query, the EXISTS subquery is not easily tied to the IF statement.&lt;/P&gt;
&lt;P&gt;But, there is in fact request logging for these statements (in my test using "dbsrv12 -zr ALL -zp -zo rll.log ...").&lt;/P&gt;
&lt;P&gt;For example, the following code:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;CREATE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;OR&lt;/SPAN&gt; &lt;SPAN class="n"&gt;REPLACE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;PROCEDURE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;myProc&lt;/SPAN&gt;&lt;SPAN class="p"&gt;()&lt;/SPAN&gt; 
&lt;SPAN class="n"&gt;RESULT&lt;/SPAN&gt; &lt;SPAN class="p"&gt;(&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ret&lt;/SPAN&gt; &lt;SPAN class="n"&gt;LONG&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VARCHAR&lt;/SPAN&gt; &lt;SPAN class="p"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;BEGIN&lt;/SPAN&gt;
    &lt;SPAN class="n"&gt;DECLARE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ret&lt;/SPAN&gt; &lt;SPAN class="n"&gt;LONG&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VARCHAR&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="n"&gt;IF&lt;/SPAN&gt; &lt;SPAN class="n"&gt;EXISTS&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="o"&gt;*&lt;/SPAN&gt; &lt;SPAN class="n"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="n"&gt;SYS&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SYSTAB&lt;/SPAN&gt; &lt;SPAN class="n"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;table_id&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;3408&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;THEN&lt;/SPAN&gt;
        &lt;SPAN class="n"&gt;SET&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ret&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'1'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="k"&gt;END&lt;/SPAN&gt; &lt;SPAN class="n"&gt;IF&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="n"&gt;IF&lt;/SPAN&gt; &lt;SPAN class="n"&gt;EXISTS&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="o"&gt;*&lt;/SPAN&gt; &lt;SPAN class="n"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="n"&gt;SYS&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SYSTAB&lt;/SPAN&gt; &lt;SPAN class="n"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;table_name&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'Robert'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;THEN&lt;/SPAN&gt;
        &lt;SPAN class="n"&gt;SET&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ret&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'2'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="k"&gt;END&lt;/SPAN&gt; &lt;SPAN class="n"&gt;IF&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="n"&gt;IF&lt;/SPAN&gt; &lt;SPAN class="n"&gt;EXISTS&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="o"&gt;*&lt;/SPAN&gt; &lt;SPAN class="n"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="n"&gt;SYS&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SYSPROCEDURE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;proc_name&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'myProc'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;THEN&lt;/SPAN&gt;
        &lt;SPAN class="n"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="n"&gt;COUNT&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="o"&gt;*&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;INTO&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ret&lt;/SPAN&gt; &lt;SPAN class="n"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="n"&gt;SYS&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SYSPROCEDURE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;proc_name&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'myProc'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="k"&gt;END&lt;/SPAN&gt; &lt;SPAN class="n"&gt;IF&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="n"&gt;SET&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ret&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'0'&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="n"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ret&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;END&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="n"&gt;CALL&lt;/SPAN&gt; &lt;SPAN class="n"&gt;myProc&lt;/SPAN&gt;&lt;SPAN class="p"&gt;();&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;Produces the following plan information in the request log:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="o"&gt;+&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;P&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,[&lt;/SPAN&gt;&lt;SPAN class="n"&gt;R&lt;/SPAN&gt;&lt;SPAN class="p"&gt;][&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;0&lt;/SPAN&gt;&lt;SPAN class="p"&gt;]&lt;/SPAN&gt;&lt;SPAN class="n"&gt;tab&lt;/SPAN&gt;&lt;SPAN class="sr"&gt;&amp;lt;ISYSTAB(IO)&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;P&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,[&lt;/SPAN&gt;&lt;SPAN class="n"&gt;R&lt;/SPAN&gt;&lt;SPAN class="p"&gt;][&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;]&lt;/SPAN&gt;&lt;SPAN class="n"&gt;tab&lt;/SPAN&gt;&lt;SPAN class="sr"&gt;&amp;lt;table_name(IO)&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="o"&gt;+&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;P&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,[&lt;/SPAN&gt;&lt;SPAN class="n"&gt;R&lt;/SPAN&gt;&lt;SPAN class="p"&gt;][&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;]&lt;/SPAN&gt;&lt;SPAN class="n"&gt;b&lt;/SPAN&gt;&lt;SPAN class="sr"&gt;&amp;lt;procedure_name(IO)&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,[,&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;myProc&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;15&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; &lt;SPAN class="n"&gt;COUNT&lt;/SPAN&gt;&lt;SPAN class="p"&gt;()&lt;/SPAN&gt; &lt;SPAN class="n"&gt;into&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ret&lt;/SPAN&gt; &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="n"&gt;SYS&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SYSPROCEDURE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;where&lt;/SPAN&gt; &lt;SPAN class="n"&gt;proc_name&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'myProc'&lt;/SPAN&gt;
&lt;SPAN class="o"&gt;+&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;12&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;P&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,[&lt;/SPAN&gt;&lt;SPAN class="n"&gt;R&lt;/SPAN&gt;&lt;SPAN class="p"&gt;][&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;]&lt;/SPAN&gt;&lt;SPAN class="n"&gt;GrByS&lt;/SPAN&gt;&lt;SPAN class="p"&gt;[&lt;/SPAN&gt; &lt;SPAN class="n"&gt;b&lt;/SPAN&gt;&lt;SPAN class="sr"&gt;&amp;lt;procedure_name(IO)&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="p"&gt;]&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;As you can see, the output is fairly obscure. Also, the SELECT COUNT(*)... plan is pretty clearly tied to its query. This output can get better if the query can be executed apart from the if statement (although not ideal) as in:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;DECLARE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;test&lt;/SPAN&gt; &lt;SPAN class="n"&gt;INTEGER&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="n"&gt;INTO&lt;/SPAN&gt; &lt;SPAN class="n"&gt;test&lt;/SPAN&gt; &lt;SPAN class="n"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="n"&gt;SYS&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;DUMMY&lt;/SPAN&gt; &lt;SPAN class="n"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;EXISTS&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="o"&gt;...&lt;/SPAN&gt;&lt;SPAN class="p"&gt;);&lt;/SPAN&gt; &lt;SPAN class="sr"&gt;//&lt;/SPAN&gt; &lt;SPAN class="ow"&gt;or&lt;/SPAN&gt; &lt;SPAN class="n"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="n"&gt;TOP&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="n"&gt;INTO&lt;/SPAN&gt; &lt;SPAN class="n"&gt;test&lt;/SPAN&gt; &lt;SPAN class="n"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="o"&gt;...&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;IF&lt;/SPAN&gt; &lt;SPAN class="n"&gt;test&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="n"&gt;THEN&lt;/SPAN&gt;
    &lt;SPAN class="sr"&gt;//i&lt;/SPAN&gt;&lt;SPAN class="n"&gt;t&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;exists&lt;/SPAN&gt;&lt;SPAN class="o"&gt;!&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;END&lt;/SPAN&gt; &lt;SPAN class="n"&gt;IF&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;Again, not ideal, but I hope this can provide some more ammo to tackle the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2012 20:39:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/getting-plans-for-statements-inside-a-function-or-procedure/qaa-p/13818099#M4848942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-26T20:39:00Z</dc:date>
    </item>
  </channel>
</rss>

