<?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 Select rows that have invalid subtype/domain values using SQL in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1186029#M7724</link>
    <description>&lt;P&gt;Oracle 18c 10.7.1 EGDB:&lt;/P&gt;&lt;P&gt;In an SQL query, is there a way to select rows that have:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Invalid subtype code values (or invalid subtype domain values)&lt;/LI&gt;&lt;LI&gt;Or invalid coded-value domain values (non-subtype)&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Sun, 07 Aug 2022 21:28:55 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2022-08-07T21:28:55Z</dc:date>
    <item>
      <title>Select rows that have invalid subtype/domain values using SQL</title>
      <link>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1186029#M7724</link>
      <description>&lt;P&gt;Oracle 18c 10.7.1 EGDB:&lt;/P&gt;&lt;P&gt;In an SQL query, is there a way to select rows that have:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Invalid subtype code values (or invalid subtype domain values)&lt;/LI&gt;&lt;LI&gt;Or invalid coded-value domain values (non-subtype)&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Sun, 07 Aug 2022 21:28:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1186029#M7724</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-08-07T21:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows that have invalid domain values using SQL</title>
      <link>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1186800#M7727</link>
      <description>&lt;P&gt;Did you mean from Oracle directly (without ArcGIS)?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 15:27:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1186800#M7727</guid>
      <dc:creator>DanaNolan</dc:creator>
      <dc:date>2022-06-27T15:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows that have invalid domain values using SQL</title>
      <link>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1186812#M7728</link>
      <description>&lt;P&gt;Hi Dana,&lt;/P&gt;&lt;P&gt;Yes. I'm hoping to use a query in SQL Developer for this. Or a database view. I edited the question to clarify.&lt;/P&gt;&lt;P&gt;But I suppose that same solution (an SQL query) could also be used in an ArcGIS Pro definition query or Select By Attributes — by nesting the query in a subquery:&lt;/P&gt;&lt;PRE&gt;objectid in&lt;BR /&gt;(select&lt;BR /&gt;&amp;nbsp; &amp;nbsp; objectid&lt;BR /&gt;from&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;my query or view&amp;gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently working on writing an SQL query. I'll let you know what I come up with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 03:24:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1186812#M7728</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-07-18T03:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows that have invalid subtype/domain values using SQL</title>
      <link>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1192796#M7782</link>
      <description>&lt;P&gt;Here's what I came up with:&lt;/P&gt;&lt;PRE&gt;--create or replace view qc_lc_events_fields_vs_domains_vw as 
select
    objectid,
    event_id,
    field_domain_mismatch --Only displays the first problem field that's found for each row. Once the first problem is fixed, the next problem will be displayed.
from
    (
    select
        a.objectid,
        a.event_id,
        --Info about DECODE and nulls: https://blog.tuningsql.com/oracle-coding-around-null-values/#:~:text=NULL%20values%20to%20be%20equivalent
        case
            when decode(a.event_status, b.code,        'SAME', 'DIFF') = 'DIFF' then 'EVENT_STATUS'
            when decode(a.asset_class,  c.code,        'SAME', 'DIFF') = 'DIFF' then 'ASSET_CLASS'
            when decode(a.strategy,     d.code,        'SAME', 'DIFF') = 'DIFF' then 'STRATEGY'
            when decode(a.activity,     e.domain_code, 'SAME', 'DIFF') = 'DIFF' then 'ACTIVITY'
            when decode(a.project_lead, f.code,        'SAME', 'DIFF') = 'DIFF' then 'PROJECT_LEAD'
            when decode(a.side,         g.code,        'SAME', 'DIFF') = 'DIFF' then 'SIDE'
        end as field_domain_mismatch
    from
        infrastr.lc_events a
    left join
        infrastr.d_event_status_vw b
        on a.event_status = b.code
    left join
        infrastr.sub_lc_events_asset_class_vw c
        on a.asset_class = c.code
    left join
        infrastr.d_strategy_vw d
        on a.strategy = d.code
    left join
        infrastr.d_activity_lc_events_asset_class_subtype_vw e
        on a.asset_class = e.subtype_code and a.activity = e.domain_code
    left join
        infrastr.d_municipality_vw f
        on a.project_lead = f.code
    left join
        infrastr.d_direction_vw g
        on a.side = g.code
    )
where
    field_domain_mismatch is not null&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1658114012361.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/46026i02CAE12A82906DA8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_0-1658114012361.png" alt="Bud_0-1658114012361.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Source for the domain views (the views that start with "d_" such as&amp;nbsp;d_event_status_vw):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://gis.stackexchange.com/a/434761/62572" target="_blank" rel="noopener"&gt;Select domain codes/descriptions using XMLTABLE instead of EXTRACTVALUE&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;The query in that link selects&amp;nbsp;&lt;U&gt;&lt;EM&gt;all&lt;/EM&gt;&lt;/U&gt; domains. Whereas, for my "d_" views, I have a WHERE clause that only selects the domain data (codes &amp;amp; descriptions) for a &lt;U&gt;&lt;EM&gt;specific&lt;/EM&gt;&lt;/U&gt; domain.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Source for the domain view&amp;nbsp;d_activity_lc_events_asset_class_subtype_vw (also has subtype columns):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://gis.stackexchange.com/questions/436108/for-each-domain-of-a-subtype-field-select-the-domain-data-and-subtype-data-usi" target="_self"&gt;For each domain of a subtype field, select the domain data and subtype data (using SQL)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Source for the subtype view&amp;nbsp;sub_lc_events_asset_class_vw:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://gis.stackexchange.com/questions/434582/select-subtype-and-a-subtype-fields-domain-names-using-sql" target="_self"&gt;Select subtype and a subtype field's domain names using SQL&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Related:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://gis.stackexchange.com/questions/434701/find-problem-rows-in-gdb-items-vw" target="_self"&gt;Find problem rows in GDB_ITEMS_VW&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://stackoverflow.com/questions/72985632/join-to-xml-query-is-only-performant-with-redundant-hardcoded-where-clause" target="_self"&gt;Join to XML query is only performant with redundant hardcoded WHERE clause&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://stackoverflow.com/questions/72760788/extract-specific-value-from-xml-array-where-fieldname-x" target="_self"&gt;Extract specific value from XML array (where FieldName = x)&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/data-management-ideas/update-oracle-gdb-docs-extractvalue-is-deprecated/idi-p/1187342/jump-to/first-unread-message" target="_self"&gt;Update Oracle GDB docs: EXTRACTVALUE is deprecated, use XMLTABLE instead (faster)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 03:27:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/select-rows-that-have-invalid-subtype-domain/m-p/1192796#M7782</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-07-18T03:27:04Z</dc:date>
    </item>
  </channel>
</rss>

