<?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: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880506#M1960624</link>
    <description>&lt;P&gt;Why should you need a commit within the same database session? If it were true, then the following code would be useless:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DELETE FROM ztable. "#EC CI_NOWHERE
IF sy-subrc IS INITIAL.
  INSERT ztable FROM TABLE my_data ACCEPTING DUPLICATE ROWS.
  IF sy-subrc IS INITIAL.
    COMMIT WORK.
  ELSE.
    ROLLBACK WORK.
  ENDIF.
ELSE.
  ROLLBACK WORK.
ENDIF.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If the insert failed, we'd be left with an empty table, which is not what we want.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 12:32:45 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2019-06-12T12:32:45Z</dc:date>
    <item>
      <title>SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880498#M1960616</link>
      <description>&lt;P&gt;So, we've got code like this:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA my_data type hashed table of ztable with unique key keyfield.
...
DELETE FROM ztable. "#EC CI_NOWHERE
INSERT ztable FROM TABLE my_data.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;And at the insert, we're getting the dump SAPSQL_ARRAY_INSERT_DUPREC.&lt;/P&gt;
  &lt;P&gt;Database is Oracle. &lt;STRONG&gt;ztable &lt;/STRONG&gt;contains ~200 records before the delete, &lt;STRONG&gt;my_data&lt;/STRONG&gt; is of a similar size.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 14:17:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880498#M1960616</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-11T14:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880499#M1960617</link>
      <description>&lt;UL&gt;&lt;LI&gt;Are there duplicates in your own internal table (is keyfield the only primary key with client in db table ?)&lt;/LI&gt;&lt;LI&gt;Isn't the actual statement INSERT ztable FROM TABLE my_data.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 11 Jun 2019 14:54:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880499#M1960617</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2019-06-11T14:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880500#M1960618</link>
      <description>&lt;P&gt;Database unique index, database triggers, ...&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 15:32:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880500#M1960618</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-06-11T15:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880501#M1960619</link>
      <description>&lt;P&gt; &lt;SPAN class="mention-scrubbed"&gt;raymond.giuseppi&lt;/SPAN&gt; corrected, thank you.&lt;/P&gt;&lt;P&gt;No, there are no duplicates in my internal table. There can't be - it's hashed. The key of the internal table is identical to the key of the db table.&lt;/P&gt;&lt;P&gt;No database triggers.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 07:04:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880501#M1960619</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-12T07:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880502#M1960620</link>
      <description>&lt;UL&gt;&lt;LI&gt;What are the technical settings of the ztable, &lt;/LI&gt;&lt;LI&gt;Are there some unique secondary indexes&lt;/LI&gt;&lt;LI&gt;Does a call of db_commit FM between the two statements solve the problem (but why would it be required...)&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 12 Jun 2019 07:40:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880502#M1960620</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2019-06-12T07:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880503#M1960621</link>
      <description>&lt;P&gt;I think you need a commit work after the delete because, otherwise, the command is still between your report and the database.&lt;/P&gt;&lt;P&gt;If you follow in debug the code, stopping 1-2 seconds after the delete, you still have the error?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 08:53:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880503#M1960621</guid>
      <dc:creator>SimoneMilesi</dc:creator>
      <dc:date>2019-06-12T08:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880504#M1960622</link>
      <description>&lt;P&gt;commit in between is missing&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 09:31:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880504#M1960622</guid>
      <dc:creator>RobertVit</dc:creator>
      <dc:date>2019-06-12T09:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880505#M1960623</link>
      <description>&lt;P&gt;I'm beginning to think it's a timing issue. But we should be able to stack SQL - otherwise the rollback mechanism is pointless - we'd be unable to do this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DELETE FROM ztable. "#EC CI_NOWHERE
IF sy-subrc IS INITIAL.
  INSERT ztable FROM TABLE my_data ACCEPTING DUPLICATE ROWS.
  IF sy-subrc IS INITIAL.
    COMMIT WORK.
  ELSE.
    ROLLBACK WORK.
  ENDIF.
ELSE.
  ROLLBACK WORK.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Maybe I should put the db updates into an update FM.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 09:34:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880505#M1960623</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-12T09:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880506#M1960624</link>
      <description>&lt;P&gt;Why should you need a commit within the same database session? If it were true, then the following code would be useless:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DELETE FROM ztable. "#EC CI_NOWHERE
IF sy-subrc IS INITIAL.
  INSERT ztable FROM TABLE my_data ACCEPTING DUPLICATE ROWS.
  IF sy-subrc IS INITIAL.
    COMMIT WORK.
  ELSE.
    ROLLBACK WORK.
  ENDIF.
ELSE.
  ROLLBACK WORK.
ENDIF.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If the insert failed, we'd be left with an empty table, which is not what we want.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 12:32:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880506#M1960624</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-12T12:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880507#M1960625</link>
      <description>&lt;P&gt;The internal table maybe of type hash with a unique key but it could create a duplicate if the DB table key is not equivalent.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:40:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880507#M1960625</guid>
      <dc:creator>former_member378318</dc:creator>
      <dc:date>2019-06-12T13:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880508#M1960626</link>
      <description>&lt;P&gt;It is identical.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:53:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880508#M1960626</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-12T13:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880509#M1960627</link>
      <description>&lt;P&gt;If you really want to always prevent any exception, you may be required to read current data in a old_records_itab and match it with new records to identify records to create, update, delete or ignore, then execute the 3 statements. Many update FM expect such internal table as parameters.&lt;/P&gt;&lt;P&gt;Meanwhile, did you check values of sy-subrc and sy-dbcnt after each abap sql statement?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:10:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880509#M1960627</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2019-06-12T14:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAPSQL_ARRAY_INSERT_DUPREC inserting unique records into empty DB table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880510#M1960628</link>
      <description>&lt;P&gt;The reason for the dump is that the table was buffered, and it wasn't synced across application servers.&lt;/P&gt;&lt;P&gt;Thanks all for your thoughts.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 08:12:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapsql-array-insert-duprec-inserting-unique-records-into-empty-db-table/m-p/11880510#M1960628</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-21T08:12:32Z</dc:date>
    </item>
  </channel>
</rss>

