<?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: Oracle Database View — Casting rownum as integer treated as double, but casting rownum as number(38,0) treated as long in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/oracle-database-view-casting-rownum-as-integer/m-p/1591894#M9515</link>
    <description>&lt;P&gt;Which Pro? 3.2 introduced support for 64-bit integers. Up until then wide integers (except "NUMBER(38)") mapped to 64-bit float. [3.2.0 had issues with arcpy.ArcSDESQLExecute processing of 64-bit ints as 16-bit (massive overflow/underflow), but that was fixed by 3.2.1.]&lt;/P&gt;&lt;P&gt;The root of this issue is the lack of standard numeric types (short/int/long/real/float) in Oracle (everything is a "NUMBER"), forcing Esri to have to decide what type to map each NUMBER flavor to...&amp;nbsp; Is NUMBER(10) a long integer, or a float (over 2.14e+10 INT_MAX)?&lt;/P&gt;&lt;P&gt;If Oracle implemented an "int" type, the "&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;cast(rownum as int)&lt;/FONT&gt;&lt;/STRONG&gt;" would work, but instead it maps it to a NUMBER which has resolution that overflows 32-bit storage (and isn't "NUMBER(38)"), so it falls back to double precision. I wonder if NUMBER(10) won't map to 64-bit integer once you get to Pro 3.3.x...&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;P&gt;PS: And be careful with casting rownum to a registered rowid column, because changing the ORDER BY would change the order (and so can the optimizer, at its whim). Since the point of a registered rowid column is to link queries to a specific row, with a WHERE clause, then&amp;nbsp;the rownum values could differ on subsequent query.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Mar 2025 19:15:52 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2025-03-04T19:15:52Z</dc:date>
    <item>
      <title>Oracle Database View — Casting rownum as integer treated as double, but casting rownum as number(38,0) treated as long</title>
      <link>https://community.esri.com/t5/geodatabase-questions/oracle-database-view-casting-rownum-as-integer/m-p/1591849#M9514</link>
      <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 2.9.5; Oracle 18c 10.7.1 EGDB&lt;BR /&gt;(will be upgraded to Pro 3.3.5; Oracle 19c 11.3 EGDB soon)&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;STRONG&gt;Background:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I have inherited an unregistered database view (non-spatial). The view has some joins.&lt;/P&gt;&lt;PRE&gt;select 
    --cast(rownum as number(38,0)) as rownum_,
    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;cast(rownum as int) as rownum_,&lt;/STRONG&gt;&lt;/FONT&gt;
    sn.rdsec, 
    sn.ownership, 
    sn.name, 
    sn.from_, 
    sn.to_, 
    sn.boundary_rd, 
    sn.boundary_juris, 
    sn.sort, 
    sn.surf_mater, 
    sn.surf_width, 
    sn.shold_type, 
    sn.shold_width, 
    sn.row_, 
    sn.desrow, 
    sn.platw, 
    sn.environ, 
    sn.fenviron, 
    sn.tcyear1, 
    sn.tcaadt,
    sn.aspd,
    sn.replac_surf_width, 
    sn.class_op_grouped, 
    sn.recon_activity, 
    sde.st_length(sn.shape) as road_length, 
    rs.length_assumed_only,
    sde.st_length(sn.shape) - rs.length_assumed_only as length_vs_assumed,
    sn.numb_lanes, 
    sn.lane_km, 
    sn.strad_wavg, 
    sn.surface_condition_wavg, 
    sn.surf_year, 
    sn.base_year, 
    sn.gran_year, 
    sn.surf_age, 
    sn.base_age, 
    sn.gran_age, 
    sn.det_model_constr_type, 
    sn.next_forecast_activity, 
    sn.next_forecast_activity_descr, 
    sn.next_forecat_year, 
    sn.last_forecast_activity, 
    sn.last_forecast_activity_descr, 
    sn.last_forecat_year, 
    arw.replacement_cost
from 
    infrastr.strln_svw sn 
left join 
    infrastr.ar_road_vw arw 
on 
    sn.rdsec = arw.inventory_asset_id 
left join 
    infrastr.am_excluded_roads_sd er 
on 
    sn.rdsec = er.rdsec
left join
    (
    select
        rdsec,
        sum(evt_to - evt_from) as length_assumed_only
    from
        infrastr.road_assm_status
    where
        assm_status = 'A'
    group by
        rdsec
    ) rs
on
    sn.rdsec = rs.rdsec
where 
    er.rdsec is null 
    and (sn.aspd &amp;lt;&amp;gt; 'UNIMPROVED' or sn.aspd is null) 
    and rs.length_assumed_only is not null&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regarding casting ROWNUM as an integer:&lt;/P&gt;&lt;PRE&gt;cast(rownum as int) as rownum_,&lt;/PRE&gt;&lt;P&gt;ArcGIS Pro is treating the ROWNUM_ column as a double:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1741111517778.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126925i3A4D4FE04D99B3A4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_0-1741111517778.png" alt="Bud_0-1741111517778.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So ROWNUM_ can't be used as the unique ID when dragging the view from Contents to the map:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_1-1741111644277.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126927iE90E2A4D9EF31B82/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_1-1741111644277.png" alt="Bud_1-1741111644277.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;However, if I were to cast ROWNUM as a&amp;nbsp;&amp;nbsp;number(38,0), then ArcGIS Pro would treat it as a long integer, which is good:&lt;/P&gt;&lt;PRE&gt;cast(rownum as number(38,0))&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_3-1741112056967.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126934i85512B391A8977F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_3-1741112056967.png" alt="Bud_3-1741112056967.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_4-1741112125890.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126935i7D0737CD574DA6A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_4-1741112125890.png" alt="Bud_4-1741112125890.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Why does Pro treat&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;cast(rownum as int)&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; as a double?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 21:50:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/oracle-database-view-casting-rownum-as-integer/m-p/1591849#M9514</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2025-03-06T21:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle Database View — Casting rownum as integer treated as double, but casting rownum as number(38,0) treated as long</title>
      <link>https://community.esri.com/t5/geodatabase-questions/oracle-database-view-casting-rownum-as-integer/m-p/1591894#M9515</link>
      <description>&lt;P&gt;Which Pro? 3.2 introduced support for 64-bit integers. Up until then wide integers (except "NUMBER(38)") mapped to 64-bit float. [3.2.0 had issues with arcpy.ArcSDESQLExecute processing of 64-bit ints as 16-bit (massive overflow/underflow), but that was fixed by 3.2.1.]&lt;/P&gt;&lt;P&gt;The root of this issue is the lack of standard numeric types (short/int/long/real/float) in Oracle (everything is a "NUMBER"), forcing Esri to have to decide what type to map each NUMBER flavor to...&amp;nbsp; Is NUMBER(10) a long integer, or a float (over 2.14e+10 INT_MAX)?&lt;/P&gt;&lt;P&gt;If Oracle implemented an "int" type, the "&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;cast(rownum as int)&lt;/FONT&gt;&lt;/STRONG&gt;" would work, but instead it maps it to a NUMBER which has resolution that overflows 32-bit storage (and isn't "NUMBER(38)"), so it falls back to double precision. I wonder if NUMBER(10) won't map to 64-bit integer once you get to Pro 3.3.x...&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;P&gt;PS: And be careful with casting rownum to a registered rowid column, because changing the ORDER BY would change the order (and so can the optimizer, at its whim). Since the point of a registered rowid column is to link queries to a specific row, with a WHERE clause, then&amp;nbsp;the rownum values could differ on subsequent query.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 19:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/oracle-database-view-casting-rownum-as-integer/m-p/1591894#M9515</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2025-03-04T19:15:52Z</dc:date>
    </item>
  </channel>
</rss>

