<?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: Duplicate objectid in Views - Best practise to solve? in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1373177#M8826</link>
    <description>&lt;P&gt;See first row - "&lt;SPAN&gt;I've run into a problem with an &lt;STRONG&gt;Oracle&lt;/STRONG&gt; View..." so yes, it's Oracle.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2024 20:51:34 GMT</pubDate>
    <dc:creator>AndersMark</dc:creator>
    <dc:date>2024-01-22T20:51:34Z</dc:date>
    <item>
      <title>Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1256462#M8260</link>
      <description>&lt;P&gt;I've run into a problem with an Oracle View that produces duplicates of column OBJECTID.&lt;/P&gt;&lt;P&gt;The underlying geo-table has of course unique objectid:s but in the view, every geometry can occur severeal times. This violates&amp;nbsp;&lt;SPAN&gt;functionality that requires that the ObjectID be unique.&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/object-id.htm" target="_blank"&gt;https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/object-id.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The view is a registred view in ArcGIS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In my case I have a ArcMap service that consumes the view and when duplicate objectids are spotted it aggregates all rows with the same objectid. Maybe thats fine with the geometrys, as many lines can exist in a poly line field. The problem is the attributes where only one of aggregated rows will represent the geometry/row when consumed in the map service. Maybe it's the first row of the aggregated records that will display in the map or one of the others, it's hard to tell. It feels random.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a best practise to solve this kind of issue?&lt;/P&gt;&lt;P&gt;I have tried to make the view generate it's own unique value in the OBJECTID column instead reading that's&amp;nbsp; written in the underlying table but when I do this it's not possible to register the view in ArcGIS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 12:55:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1256462#M8260</guid>
      <dc:creator>AndersMark</dc:creator>
      <dc:date>2023-02-09T12:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1256489#M8261</link>
      <description>&lt;P&gt;I would recommend using &lt;STRONG&gt;SELECT DISTINCT&lt;/STRONG&gt; together with &lt;STRONG&gt;ORDER&lt;/STRONG&gt; &lt;STRONG&gt;BY &lt;/STRONG&gt;to control the order in which your duplicates appear, if you need to consistently choose one result. Can you share the full query, though? If you're aggregating everything properly, there shouldn't be any duplicates.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 14:36:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1256489#M8261</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-02-09T14:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1259816#M8278</link>
      <description>&lt;P&gt;I will try to explain:&lt;/P&gt;&lt;P&gt;I can't use distinct because every line in the view are correct which means it wouldn't be correct to use just one of the duplicate objectid:s. I.e. data would be missing. The view joins several tables inlucing one geometry table. The same geometry kan be used from more that one row in the view. This is the reason for duplicate object ids. The problem is that ArcGIS depends on that every geotable or geoview contains unique values for OBJECTID.&amp;nbsp; I a view doesn't fulfill that need, ArcGis will automatically aggregate duplicate objectid:s and create a multipart feature but with attribute values from just one of the aggregated records. When checking information about&amp;nbsp; one of those geometries you will see every geometry but only attribute values for one of them.&amp;nbsp; This leads to lack of information which is not preferred.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the problem more clear now?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 12:59:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1259816#M8278</guid>
      <dc:creator>AndersMark</dc:creator>
      <dc:date>2023-02-20T12:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371587#M8806</link>
      <description>&lt;P&gt;i have de same problem, you can resolve de issue&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 14:10:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371587#M8806</guid>
      <dc:creator>Alvaro1977</dc:creator>
      <dc:date>2024-01-18T14:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371641#M8808</link>
      <description>&lt;P&gt;I've had success using Oracle's ROWNUM pseudocolumn as a fake/unique ObjectID when there are duplicate ObjectIDs in the query.&lt;/P&gt;&lt;PRE&gt;select
    cast(rownum as int) as rownum_,
    r.*
from
    my_user.roads r&lt;/PRE&gt;&lt;P&gt;But a couple of extra steps are required:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;ArcGIS doesn't seem to recognize the ROWNUM values as integers. So I need to cast it as an int.&lt;OL class="lia-list-style-type-lower-alpha"&gt;&lt;LI&gt;Alternatively, cast it like this:&amp;nbsp;&lt;FONT face="courier new,courier" color="#0000FF"&gt;cast(rownum as number(38,0)) as rownum_&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;When it comes to creating a view, Oracle doesn't like it when I name the column as ROWNUM, since that's a reserve word. I need to name it ROWNUM&lt;STRONG&gt;_&lt;/STRONG&gt; with an underscore (or something similar), or name it as OBJECTID.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Related:&amp;nbsp;&lt;A href="https://gis.stackexchange.com/questions/203630/converting-double-field-to-integer-in-database-view-so-arcmap-query-layer-can-us" target="_self"&gt;Converting double field to integer in database view so ArcMap query layer can use field as unique identifier&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 15:42:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371641#M8808</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-18T15:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371643#M8809</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/379796"&gt;@Alvaro1977&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What kind of database? Oracle?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not Oracle, then does your RDBMS have the equivalent of Oracle's ROWNUM pseudocolumn?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 15:41:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371643#M8809</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-18T15:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371668#M8810</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Yes, it worked, &lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Jan 2024 15:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371668#M8810</guid>
      <dc:creator>Alvaro1977</dc:creator>
      <dc:date>2024-01-18T15:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371674#M8811</link>
      <description>&lt;P&gt;yes, i use rownum in the query .&amp;nbsp;&lt;/P&gt;&lt;P&gt;select cast(rownum as number(38.0)) as objecid,&lt;BR /&gt;d.shape,&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 15:49:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1371674#M8811</guid>
      <dc:creator>Alvaro1977</dc:creator>
      <dc:date>2024-01-18T15:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate objectid in Views - Best practise to solve?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1373177#M8826</link>
      <description>&lt;P&gt;See first row - "&lt;SPAN&gt;I've run into a problem with an &lt;STRONG&gt;Oracle&lt;/STRONG&gt; View..." so yes, it's Oracle.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 20:51:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/duplicate-objectid-in-views-best-practise-to-solve/m-p/1373177#M8826</guid>
      <dc:creator>AndersMark</dc:creator>
      <dc:date>2024-01-22T20:51:34Z</dc:date>
    </item>
  </channel>
</rss>

