<?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 How to use the pl/sql MERGE statement against a versioned view in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/how-to-use-the-pl-sql-merge-statement-against-a/m-p/833565#M4353</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have to update a versioned table using data from an unversioned table.&amp;nbsp; These two tables represent customer data and have over 1 million rows in each.&amp;nbsp; The geodatabase is Oracle 11g and the ArcGIS version is 10.2.1.&amp;nbsp; The Oracle MERGE statement seems perfect for this situation.&amp;nbsp; The source is the unversioned table and the target is the version view of the versioned table (ending in _EVW).&amp;nbsp; However, when I try to use the Oracle MERGE statement I get this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Error: ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.&lt;/P&gt;&lt;P&gt;01446. 00000 -&amp;nbsp; "cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get this error when the target of the MERGE statement is a versioned view.&amp;nbsp; I don't get it when the target is a unversioned table.&amp;nbsp; Does anyone have experience using the Oracle MERGE statement where the target is a versioned view?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement that fails in sql plus is :&lt;/P&gt;&lt;P&gt;MERGE INTO SERVICEDELIVERYPOINT_EVW S&lt;/P&gt;&lt;P&gt;USING (SELECT SITE, ISSEQ, PRIORITY FROM CISCATALOG) C&lt;/P&gt;&lt;P&gt;ON (C.SITE = S.SITEID AND C.ISSEQ = S.SEQUENCE)&lt;/P&gt;&lt;P&gt;WHEN MATCHED THEN &lt;/P&gt;&lt;P&gt;UPDATE SET S.PRIORITY = C.PRIORITY&lt;/P&gt;&lt;P&gt;WHEN NOT MATCHED THEN INSERT (S.SITEID, S.SEQUENCE) VALUES (C.SITE, C.ISSEQ)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Apr 2016 20:36:51 GMT</pubDate>
    <dc:creator>TheodoreRakel</dc:creator>
    <dc:date>2016-04-19T20:36:51Z</dc:date>
    <item>
      <title>How to use the pl/sql MERGE statement against a versioned view</title>
      <link>https://community.esri.com/t5/geodatabase-questions/how-to-use-the-pl-sql-merge-statement-against-a/m-p/833565#M4353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have to update a versioned table using data from an unversioned table.&amp;nbsp; These two tables represent customer data and have over 1 million rows in each.&amp;nbsp; The geodatabase is Oracle 11g and the ArcGIS version is 10.2.1.&amp;nbsp; The Oracle MERGE statement seems perfect for this situation.&amp;nbsp; The source is the unversioned table and the target is the version view of the versioned table (ending in _EVW).&amp;nbsp; However, when I try to use the Oracle MERGE statement I get this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Error: ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.&lt;/P&gt;&lt;P&gt;01446. 00000 -&amp;nbsp; "cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get this error when the target of the MERGE statement is a versioned view.&amp;nbsp; I don't get it when the target is a unversioned table.&amp;nbsp; Does anyone have experience using the Oracle MERGE statement where the target is a versioned view?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement that fails in sql plus is :&lt;/P&gt;&lt;P&gt;MERGE INTO SERVICEDELIVERYPOINT_EVW S&lt;/P&gt;&lt;P&gt;USING (SELECT SITE, ISSEQ, PRIORITY FROM CISCATALOG) C&lt;/P&gt;&lt;P&gt;ON (C.SITE = S.SITEID AND C.ISSEQ = S.SEQUENCE)&lt;/P&gt;&lt;P&gt;WHEN MATCHED THEN &lt;/P&gt;&lt;P&gt;UPDATE SET S.PRIORITY = C.PRIORITY&lt;/P&gt;&lt;P&gt;WHEN NOT MATCHED THEN INSERT (S.SITEID, S.SEQUENCE) VALUES (C.SITE, C.ISSEQ)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2016 20:36:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/how-to-use-the-pl-sql-merge-statement-against-a/m-p/833565#M4353</guid>
      <dc:creator>TheodoreRakel</dc:creator>
      <dc:date>2016-04-19T20:36:51Z</dc:date>
    </item>
  </channel>
</rss>

