<?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: Insert massive data using EXEC SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221657#M1628229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Man thanks Max for your input but I can't afford to use LOOP ENDLOOP because expecting to INSERT millions of record. I've solve my issue by using TRY ENDTRY block and if there is a duplicate entry then I display error. Here is my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    try.&lt;/P&gt;&lt;P&gt;      insert zced_order_idoc_records from table p_git_order_idoc_records.&lt;/P&gt;&lt;P&gt;    catch cx_sy_open_sql_db into sql_ref.&lt;/P&gt;&lt;P&gt;      err_text = sql_ref-&amp;gt;get_text( ).&lt;/P&gt;&lt;P&gt;      message err_text type 'I'.&lt;/P&gt;&lt;P&gt;    endtry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 08 Oct 2011 19:14:12 GMT</pubDate>
    <dc:creator>former_member295881</dc:creator>
    <dc:date>2011-10-08T19:14:12Z</dc:date>
    <item>
      <title>Insert massive data using EXEC SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221655#M1628227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Expert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to insert data in a custom table. Before insert I'm holding all my records in an internal table. I know using EXEC SQL I can insert data like as this.&lt;/P&gt;&lt;P&gt;===================================================&lt;/P&gt;&lt;P&gt;try.&lt;/P&gt;&lt;P&gt;    EXEC SQL&lt;/P&gt;&lt;P&gt;        insert into TABLENAME&lt;/P&gt;&lt;P&gt;         ( &lt;/P&gt;&lt;P&gt;           COLUMN1&lt;/P&gt;&lt;P&gt;           COLUMN2&lt;/P&gt;&lt;P&gt;         )&lt;/P&gt;&lt;P&gt;           VALUES&lt;/P&gt;&lt;P&gt;         (&lt;/P&gt;&lt;P&gt;            :VALUE1&lt;/P&gt;&lt;P&gt;            :VALUE2&lt;/P&gt;&lt;P&gt;          )  &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    ENDEXEC.&lt;/P&gt;&lt;P&gt;catch cx_sy_native_sql_error into gv_oref.&lt;/P&gt;&lt;P&gt;   gv_txterror = gv_oref-&amp;gt;get_text( ). &lt;/P&gt;&lt;P&gt;   message gv_txterror type 'I'.&lt;/P&gt;&lt;P&gt;endtry.&lt;/P&gt;&lt;P&gt;==================================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However my problem is I've a lot of columns in my table (45). Also I'll have to update thousands of records. I Can't do it column by column and row by row. So I've tried to update this table using the following code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=================================================&lt;/P&gt;&lt;P&gt;     try.&lt;/P&gt;&lt;P&gt;       exec sql.&lt;/P&gt;&lt;P&gt;         insert into ZCED_ORDER_IDOC from p_git_order_idoc.&lt;/P&gt;&lt;P&gt;       endexec.&lt;/P&gt;&lt;P&gt;       catch cx_sy_native_sql_error into exc_ref.&lt;/P&gt;&lt;P&gt;         error_text = exc_ref-&amp;gt;get_text( ).&lt;/P&gt;&lt;P&gt;         message error_text type 'I'.&lt;/P&gt;&lt;P&gt;    endtry.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;=================================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in exception text I get error that INTO &amp;amp; VALUE  are missing. I understand the error but as I said I can't insert value by value. So I'm wondering is there a way to insert many records at a time and If an exception occurs then I can show that message to user?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Oct 2011 17:22:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221655#M1628227</guid>
      <dc:creator>former_member295881</dc:creator>
      <dc:date>2011-10-08T17:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Insert massive data using EXEC SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221656#M1628228</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 think VALUE is obligatory, you can omit the column (if you need to fill all fields), but you can use a variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB.
   OPEN SQL.
        INSERT INTO &amp;lt;TABLE&amp;gt;
            VALUE( :ITAB-FIELD1, :ITAB-FIELD2,....., :ITAB-FIELDN)
   ENDEXEC.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Oct 2011 18:29:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221656#M1628228</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-10-08T18:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Insert massive data using EXEC SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221657#M1628229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Man thanks Max for your input but I can't afford to use LOOP ENDLOOP because expecting to INSERT millions of record. I've solve my issue by using TRY ENDTRY block and if there is a duplicate entry then I display error. Here is my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    try.&lt;/P&gt;&lt;P&gt;      insert zced_order_idoc_records from table p_git_order_idoc_records.&lt;/P&gt;&lt;P&gt;    catch cx_sy_open_sql_db into sql_ref.&lt;/P&gt;&lt;P&gt;      err_text = sql_ref-&amp;gt;get_text( ).&lt;/P&gt;&lt;P&gt;      message err_text type 'I'.&lt;/P&gt;&lt;P&gt;    endtry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Oct 2011 19:14:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221657#M1628229</guid>
      <dc:creator>former_member295881</dc:creator>
      <dc:date>2011-10-08T19:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Insert massive data using EXEC SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221658#M1628230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Solved it myself&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Oct 2011 19:15:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221658#M1628230</guid>
      <dc:creator>former_member295881</dc:creator>
      <dc:date>2011-10-08T19:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Insert massive data using EXEC SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221659#M1628231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share how you solved it please?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2011 18:58:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-massive-data-using-exec-sql/m-p/8221659#M1628231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-10-12T18:58:44Z</dc:date>
    </item>
  </channel>
</rss>

