<?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: EXEC SQL - External Database Insert multiple rows in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389331#M1238883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank,&lt;/P&gt;&lt;P&gt;Connection is OK (select from table1 working). But I have a roblem with INSERT. Can you help me?&lt;/P&gt;&lt;P&gt;This sample don't throw exception, but not insert data to table1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;EXEC &lt;SPAN class="L0S52"&gt;SQL&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;INSERT &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;TABLE1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VALUES&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S55"&gt;( &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'aaa'&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;, &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'bbb' &lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="L0S52"&gt;ENDEXEC&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;Thank you&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 May 2014 06:36:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2014-05-28T06:36:29Z</dc:date>
    <item>
      <title>EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389324#M1238876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking for the right syntax to INSERT all the records in an internal table into an external Oracle database table in a single SQL statement. There are no issues with connectivity maintained thru DBCO. &lt;/P&gt;&lt;P&gt;I'm able to connect, retrieve, update, delete and insert records in the external db table.&lt;/P&gt;&lt;P&gt;Currently I'm looping though an internal table and inserting records one by one and this is time consuming&lt;/P&gt;&lt;P&gt;when there are thousands of records.&lt;/P&gt;&lt;P&gt;Would like to insert all the records in the internal table in a single SQL statement without having to &lt;/P&gt;&lt;P&gt;loop through the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have been trying with the following statement but no luck so far:&lt;/P&gt;&lt;P&gt;INSERT INTO &amp;lt;ext.table&amp;gt; (fieldA, fieldB, fieldC)&lt;/P&gt;&lt;P&gt;   SELECT sapfldA, sapfldB, sapfldC&lt;/P&gt;&lt;P&gt;   FROM TABLE &amp;lt;sap.table&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Dvas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2009 12:52:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389324#M1238876</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-26T12:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389325#M1238877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dev,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do some RnD with Oracle DML &lt;STRONG&gt;Merge&lt;/STRONG&gt; statement. May you get some light on the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sarbajit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2009 13:26:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389325#M1238877</guid>
      <dc:creator>sarbajitm</dc:creator>
      <dc:date>2009-03-26T13:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389326#M1238878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  I have the same problem. I should copy records from SAP table to EXT table using a DBCO.&lt;/P&gt;&lt;P&gt;  I don't understand last reply....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  could you help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  1. after the open connection to external DB, Can I access to SAP table using a EXEC SQL? How?&lt;/P&gt;&lt;P&gt;  2. Can I use this statement?&lt;/P&gt;&lt;P&gt;         INSERT INTO ZZ_MARA@DDDSVI&lt;/P&gt;&lt;P&gt;               (MATNR, LVORM)&lt;/P&gt;&lt;P&gt;               SELECT (MATNR, LVORM) FROM MARA WHERE MTART = :LV_MTART&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you so much.&lt;/P&gt;&lt;P&gt;   mauro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2011 17:05:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389326#M1238878</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-16T17:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389327#M1238879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dvas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try like this ([bulk insert|http://www.dba-oracle.com/oracle_news/news_plsql_forall_performance_insert.htm])&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;EXECUTE IMMEDIATE 'TRUNCATE TABLE products';
Start_time := DBMS_UTILITY.get_time;
FORALL i in products_tab.first .. products_tab.last
 INSERT INTO products VALUES products_tab(i);
end_time := DBMS_UTILITY.get_time;
DBMS_OUTPUT.PUT_LINE(u2018Bulk Insert: u2019||to_char(end_time-start_time));
COMMIT;
END;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2011 21:19:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389327#M1238879</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2011-03-16T21:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389328#M1238880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I accomplished what you are asking by creating an Oracle dblink in the SAP database. Abaper's used to be able to do this in 4.5 and 4.7, but you may need to ask your Basis to do it in ECC6.0. This method does not need to use tcode DBCO and it does not need to have entries made in the tnsnames.ora file. Here is some code I used to create the DB link and transfer all data in SAP's FMIOI table to a table called TSAP_FMIOI in an external oracle database. This method transfers the data very quickly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement may need to be done at the Oracle level instead of using ABAP: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL. &lt;/P&gt;&lt;P&gt;CREATE DATABASE LINK xxxLINKNAMExxx CONNECT TO xxxDBUSERNAMExxx &lt;/P&gt;&lt;P&gt;IDENTIFIED BY xxxDBPASSWORDxxx USING &lt;/P&gt;&lt;P&gt;'(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = xx.xx.xxx.xxx) &lt;/P&gt;&lt;P&gt;(PORT = 1521)) (CONNECT_DATA = (SID = xxxx))' &lt;/P&gt;&lt;P&gt;ENDEXEC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the stmts I use to execute a stored procedure on the remote database and copy the FMIOI table to the remote table called TSAP_FMIOI: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL. &lt;/P&gt;&lt;P&gt;EXECUTE PROCEDURE SAP_PKG.TRUNCATE_TSAP_FMIOI@xxxDBLINKNAMExxx &lt;/P&gt;&lt;P&gt;ENDEXEC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL. &lt;/P&gt;&lt;P&gt;INSERT INTO TSAP_FMIOI@xxxDBLINKNAMExxx SELECT * FROM FMIOI &lt;/P&gt;&lt;P&gt;WHERE MANDT = 100 &lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 15:05:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389328#M1238880</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-24T15:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389329#M1238881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is possible connect to external Oracle DB from SAP using your code without create/update TnsNames.Ora file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 May 2014 19:35:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389329#M1238881</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-19T19:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389330#M1238882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think so.&amp;nbsp; I spent some time trying to do this and had no luck.&amp;nbsp; I was able to update the TNS file using transaction &lt;SPAN style="font-family: 'Arial','sans-serif'; font-size: 10pt;"&gt;CG3Z though.&amp;nbsp; From transaction&lt;/SPAN&gt; AL11, my system had it listed under DIR_PROFILE --&amp;gt; oracle --&amp;gt; tnsnames.ora.&amp;nbsp; It would be best if you had your basis team change this file though.&amp;nbsp; Hope this helps. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 22:35:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389330#M1238882</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-21T22:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389331#M1238883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank,&lt;/P&gt;&lt;P&gt;Connection is OK (select from table1 working). But I have a roblem with INSERT. Can you help me?&lt;/P&gt;&lt;P&gt;This sample don't throw exception, but not insert data to table1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;EXEC &lt;SPAN class="L0S52"&gt;SQL&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;INSERT &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;TABLE1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VALUES&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S55"&gt;( &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'aaa'&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;, &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'bbb' &lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="L0S52"&gt;ENDEXEC&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;Thank you&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 06:36:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389331#M1238883</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-28T06:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: EXEC SQL - External Database Insert multiple rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389332#M1238884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all I hope that the tables involve are none SAP tables (Z tables) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did not try this myself but have a look at:&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;&lt;A class="jive-link-blog-small" data-containerid="30827" data-containertype="37" data-objectid="99556" data-objecttype="38" href="http://scn.sap.com/community/abap/blog/2013/12/26/sdbadbc--the-program"&gt;http://scn.sap.com/community/abap/blog/2013/12/26/sdbadbc--the-program&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The usage of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cl_sql_connection&amp;nbsp; &lt;BR /&gt;cl_sql_statement&amp;nbsp; &lt;BR /&gt;cl_sql_result_set&amp;nbsp; &lt;BR /&gt;cx_sql_exception&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 06:56:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exec-sql-external-database-insert-multiple-rows/m-p/5389332#M1238884</guid>
      <dc:creator>rosenberg_eitan</dc:creator>
      <dc:date>2014-05-28T06:56:13Z</dc:date>
    </item>
  </channel>
</rss>

