<?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: Modify Statement in Native SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115238#M1510328</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 to insert multiple records from an internal table into d/b table using Native SQL query.&lt;/P&gt;&lt;P&gt;Do i need to write Native SQL query in LOOP end Loop. or there is some other way (like the use of PERFORMING in case of Native SELECT query). It whould be helpful if you can provide some sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pankaj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jul 2010 15:08:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-07-28T15:08:16Z</dc:date>
    <item>
      <title>Modify Statement in Native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115236#M1510326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;1. IS there Modify statement in Native statement, same as we have in Open Sql?&lt;/P&gt;&lt;P&gt;If Yes, then pls provide the sample code.&lt;/P&gt;&lt;P&gt;If no, then what will happen if I insert the same data (with same key fields) into database. Also pls provide a sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. How to delete all the data of a particular table using Native Sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pankaj Bist.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jul 2010 15:23:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115236#M1510326</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-27T15:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Statement in Native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115237#M1510327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pankaj,&lt;/P&gt;&lt;P&gt;the answers &lt;STRONG&gt;can&lt;/STRONG&gt; be significantly different, depending on what database SAP runs on.&lt;/P&gt;&lt;P&gt;1. The ABAP sentence MODIFY allows you to insert new records or, if they already exist, updates the existing ones.&lt;/P&gt;&lt;P&gt;In Native SQL for Oracle, in older versions, you cannot insert or update (just like MODIFY does) in a single statement. You must e.g. INSERT, and if this fails (because of the primary key constraint) then you must perform an UPDATE.&lt;/P&gt;&lt;P&gt;In newer releases of Oracle (for example 9, 10g), however, there's a new statement MERGE, that works quite similarly as MODIFY in ABAP. More details in [Oracle SQL reference 10g release 2|http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9016.htm].&lt;/P&gt;&lt;P&gt;2. In Native SQL for Oracle, there's a simple statement to do so:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TRUNCATE TABLE your_table.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But watch out! you cannot rollback this statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps. Kind regards,&lt;/P&gt;&lt;P&gt;Alvaro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jul 2010 16:08:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115237#M1510327</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-27T16:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Statement in Native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115238#M1510328</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 to insert multiple records from an internal table into d/b table using Native SQL query.&lt;/P&gt;&lt;P&gt;Do i need to write Native SQL query in LOOP end Loop. or there is some other way (like the use of PERFORMING in case of Native SELECT query). It whould be helpful if you can provide some sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pankaj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jul 2010 15:08:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115238#M1510328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-28T15:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Statement in Native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115239#M1510329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pankaj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To pass from an ABAP internal table to native sql you will need a LOOP ENDLOOP.&lt;/P&gt;&lt;P&gt;Follow a code sample &lt;A href="http://help.sap.com/abapdocu_70/en/ABENNATIVE_SQL_ABEXA.htm"&gt;Native SQL - Source Code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Fernando Da Ró&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 02:06:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115239#M1510329</guid>
      <dc:creator>former_member182114</dc:creator>
      <dc:date>2010-07-29T02:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Statement in Native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115240#M1510330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure about your case, but I would prefer to use native SQL only if you do not need to do modification on the data or other complex logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This means doing an Insert using a Select query without going through an internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 06:25:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115240#M1510330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-09T06:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Statement in Native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115241#M1510331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Fernando,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to insert multiple records from internal table to database table using native sql using loop..endloop. Can you provide the source code native sql?&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;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 18:32:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115241#M1510331</guid>
      <dc:creator>former_member187732</dc:creator>
      <dc:date>2013-02-25T18:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Statement in Native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115242#M1510332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fernando,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;General way inserting data using Native SQL is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL. &lt;/P&gt;&lt;P&gt;&amp;nbsp; INSERT INTO &amp;lt;TABLENAME&amp;gt; (&amp;lt;FIELD1&amp;gt;, &amp;lt;FIELD2&amp;gt;, &amp;lt;FIELD3&amp;gt;) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VALUES (&amp;lt;VALUE1&amp;gt;,&amp;lt;VALUE3&amp;gt;&amp;lt;VALUE3&amp;gt;) &lt;/P&gt;&lt;P&gt;ENDEXEC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since in your case there is a internal table we require to loop at the table into work area, and the content of the work area is passed to the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP it_tab1 into wa_itab1.&lt;/P&gt;&lt;P&gt; INSERT INTO &amp;lt;TABLENAME&amp;gt; (&amp;lt;FIELD1&amp;gt;, &amp;lt;FIELD2&amp;gt;,....&amp;lt;FIELDN&amp;gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VALUES (:wa_itab1-field1,:wa_itab1-field2,.....:wa_itab1-fieldN)&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jul 2013 12:31:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statement-in-native-sql/m-p/7115242#M1510332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-04T12:31:39Z</dc:date>
    </item>
  </channel>
</rss>

