<?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>topic Re: Odd behavior with cl_sql_statement's 'execute_query' method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362016#M1641216</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well done! &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/98/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt; BUT I could make it work without an internal table:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;nbsp; DATA:
&amp;nbsp;&amp;nbsp;&amp;nbsp; l_stmt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE string,
&amp;nbsp;&amp;nbsp;&amp;nbsp; l_stmt_ref&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE REF TO cl_sql_statement,
&amp;nbsp;&amp;nbsp;&amp;nbsp; l_res_ref&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE REF TO cl_sql_result_set,
&amp;nbsp;&amp;nbsp;&amp;nbsp; lr_count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE REF TO data,
&amp;nbsp;&amp;nbsp;&amp;nbsp; l_count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE i.
&amp;nbsp; DATA go_conn TYPE REF TO cl_sql_connection.

&amp;nbsp; CREATE OBJECT go_conn.

* create a statement object
&amp;nbsp; l_stmt_ref = go_conn-&amp;gt;create_statement( ).

&amp;nbsp; l_stmt = 'select count(*) from t000'.
&amp;nbsp; l_res_ref = l_stmt_ref-&amp;gt;execute_query( l_stmt ).

* set output variables
&amp;nbsp; GET REFERENCE OF l_count INTO lr_count.
&amp;nbsp; l_res_ref-&amp;gt;set_param( lr_count ).

&amp;nbsp; WRITE : / l_count. " always zero
* read first result line
&amp;nbsp; l_res_ref-&amp;gt;next( ).
&amp;nbsp; WRITE : / l_count.

&amp;nbsp; l_res_ref-&amp;gt;close( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Apr 2016 20:26:30 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2016-04-02T20:26:30Z</dc:date>
    <item>
      <title>Odd behavior with cl_sql_statement's 'execute_query' method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362012#M1641212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to connect to an Oracle database and run a simple query.  I'm connecting OK but, oddly, no matter what I send to the DB via "execute_query", no rows are returned and no exceptions are thrown.  I could send a totally bogus query, e.g., a misspelled column name, and I'll get the same result, i.e., no exception, no rows.  Very peculiar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm wondering if anyone else has seen this problem before and, if so, could offer some solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 15:37:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362012#M1641212</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-01T15:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Odd behavior with cl_sql_statement's 'execute_query' method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362013#M1641213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Steve King ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am a newbie to ADBC statements and running into the same issue. Wondering if you are able to get resolution to this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rama &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Apr 2016 14:47:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362013#M1641213</guid>
      <dc:creator>Private_Member_212937</dc:creator>
      <dc:date>2016-04-02T14:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Odd behavior with cl_sql_statement's 'execute_query' method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362014#M1641214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should better ask the world rather than one guy only, probably many forum guys encountered this issue without posting...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should run the standard program ADBC_DEMO, and check whether SELECT_INTO_VARIABLES and SELECT_INTO_STRUCTURE subroutines read any rows. If yes, then ADBC and the connection work perfectly, and you need to correct your custom code (take the standard code as an example).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Apr 2016 15:16:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362014#M1641214</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2016-04-02T15:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Odd behavior with cl_sql_statement's 'execute_query' method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362015#M1641215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Sandra for the quick response. Next time , I will open a fresh posting.&lt;/P&gt;&lt;P&gt;I found the fix for the solution. My problem is specific to the statement select count(*) from &amp;lt;table&amp;gt;.&lt;/P&gt;&lt;P&gt;It appears even though the statement would return a single value , I have to declare internal table for returned value. Also for Oracle database , it appears we have to execute next_package command at least once to get the result. I found the solution at the following link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/30578267/how-to-get-the-row-count-via-adbc-native-sql"&gt;http://stackoverflow.com/questions/30578267/how-to-get-the-row-count-via-adbc-native-sql&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Apr 2016 19:21:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362015#M1641215</guid>
      <dc:creator>Private_Member_212937</dc:creator>
      <dc:date>2016-04-02T19:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Odd behavior with cl_sql_statement's 'execute_query' method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362016#M1641216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well done! &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/98/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt; BUT I could make it work without an internal table:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;nbsp; DATA:
&amp;nbsp;&amp;nbsp;&amp;nbsp; l_stmt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE string,
&amp;nbsp;&amp;nbsp;&amp;nbsp; l_stmt_ref&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE REF TO cl_sql_statement,
&amp;nbsp;&amp;nbsp;&amp;nbsp; l_res_ref&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE REF TO cl_sql_result_set,
&amp;nbsp;&amp;nbsp;&amp;nbsp; lr_count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE REF TO data,
&amp;nbsp;&amp;nbsp;&amp;nbsp; l_count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE i.
&amp;nbsp; DATA go_conn TYPE REF TO cl_sql_connection.

&amp;nbsp; CREATE OBJECT go_conn.

* create a statement object
&amp;nbsp; l_stmt_ref = go_conn-&amp;gt;create_statement( ).

&amp;nbsp; l_stmt = 'select count(*) from t000'.
&amp;nbsp; l_res_ref = l_stmt_ref-&amp;gt;execute_query( l_stmt ).

* set output variables
&amp;nbsp; GET REFERENCE OF l_count INTO lr_count.
&amp;nbsp; l_res_ref-&amp;gt;set_param( lr_count ).

&amp;nbsp; WRITE : / l_count. " always zero
* read first result line
&amp;nbsp; l_res_ref-&amp;gt;next( ).
&amp;nbsp; WRITE : / l_count.

&amp;nbsp; l_res_ref-&amp;gt;close( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Apr 2016 20:26:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362016#M1641216</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2016-04-02T20:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Odd behavior with cl_sql_statement's 'execute_query' method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362017#M1641217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Sandra !&amp;nbsp; It clears the concepts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2016 14:39:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/odd-behavior-with-cl-sql-statement-s-execute-query-method/m-p/8362017#M1641217</guid>
      <dc:creator>Private_Member_212937</dc:creator>
      <dc:date>2016-04-05T14:39:47Z</dc:date>
    </item>
  </channel>
</rss>

