<?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 SAS VIYA :- FEDSQL SUBQUERY ERROR in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866469#M342192</link>
    <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;I am facing an error in SAS Viya.&lt;/P&gt;&lt;P&gt;Error -&amp;nbsp; SAS FEDSQL doesn't supports Subquery in its Syntax. While using subquery in the code its throwing error.As i want to use in Fedsql itself, I can't use this code in Proc Sql as I'm fetching the data from database.&lt;/P&gt;&lt;P&gt;How we can resolve it. Can you please help me out?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code -:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;Proc Fedsql Mysession = Sessref;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;create table casuser.table {options replace = true compress - true} as&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;select&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;htd.TRAN_DATE,htd.tran_amt,htd.tran_id,decode(htd.part_tran_type,'C','CREDIT','DEBIT') part_tran_type,gam.acid as gamacid,htd.acid as htdacid,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;(select foracid from tbaadm.gam@finlink where acid=htd.acid)account&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;from tbaadm.htd@finlink,tbaadm.gam@finlink&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;where gam.foracid IN ('0582955100398')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and acct_cls_flg='N'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and entity_cre_flg='Y'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and htd.pstd_flg='Y'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and htd.del_flg='N'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and htd.tran_date BETWEEN '23-Mar-2023' AND '23-Mar-2023'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and (tran_id,tran_date) in (select tran_id,tran_date from tbaadm.htd@finlink where htd.acid=gam.acid);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2023 08:17:51 GMT</pubDate>
    <dc:creator>Rub_Saifi</dc:creator>
    <dc:date>2023-03-27T08:17:51Z</dc:date>
    <item>
      <title>SAS VIYA :- FEDSQL SUBQUERY ERROR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866469#M342192</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;I am facing an error in SAS Viya.&lt;/P&gt;&lt;P&gt;Error -&amp;nbsp; SAS FEDSQL doesn't supports Subquery in its Syntax. While using subquery in the code its throwing error.As i want to use in Fedsql itself, I can't use this code in Proc Sql as I'm fetching the data from database.&lt;/P&gt;&lt;P&gt;How we can resolve it. Can you please help me out?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code -:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;Proc Fedsql Mysession = Sessref;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;create table casuser.table {options replace = true compress - true} as&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;select&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;htd.TRAN_DATE,htd.tran_amt,htd.tran_id,decode(htd.part_tran_type,'C','CREDIT','DEBIT') part_tran_type,gam.acid as gamacid,htd.acid as htdacid,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;(select foracid from tbaadm.gam@finlink where acid=htd.acid)account&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;from tbaadm.htd@finlink,tbaadm.gam@finlink&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;where gam.foracid IN ('0582955100398')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and acct_cls_flg='N'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and entity_cre_flg='Y'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and htd.pstd_flg='Y'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and htd.del_flg='N'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and htd.tran_date BETWEEN '23-Mar-2023' AND '23-Mar-2023'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;and (tran_id,tran_date) in (select tran_id,tran_date from tbaadm.htd@finlink where htd.acid=gam.acid);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="sans-serif" size="2" color="#000000"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 08:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866469#M342192</guid>
      <dc:creator>Rub_Saifi</dc:creator>
      <dc:date>2023-03-27T08:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS VIYA :- FEDSQL SUBQUERY ERROR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866475#M342195</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm a bit confused since FedSQL should support sub-queries.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/casfedsql/p1ucns3lrhzhamn1k6fw6vhzhzam.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/casfedsql/p1ucns3lrhzhamn1k6fw6vhzhzam.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you post the complete log?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when you mention database, you refer to CAS, right?&lt;/P&gt;
&lt;P&gt;Since if your data is in an external DB Proc SQL works.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 08:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866475#M342195</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-03-27T08:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS VIYA :- FEDSQL SUBQUERY ERROR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866916#M342388</link>
      <description>&lt;P&gt;&lt;SPAN&gt;FedSQL for CAS does not support use of non-correlated subqueries with the IN, ANY, and ALL predicates. For example, the following non-correlated subquery is not supported:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My log Error:-&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0072B2"&gt;NOTE: CAS action completed [OKAY]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="3" color="#2A3037"&gt;FEDSQL: load of action set returned rc=00000000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="3" color="#2A3037"&gt;ERROR: Unsupported operation in FedSQL query: Correlated subquery.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="3" color="#2A3037"&gt;ERROR: Unsupported operation in FedSQL query: IN/ANY/ALL subquery.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="3" color="#2A3037"&gt;ERROR: The action stopped due to errors.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="3" color="#D80000"&gt;ERROR: The FedSQL action was not successful.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="3" color="#2A3037"&gt;FEDSQL: The fedsql.execDirect action returned rc=0x000003f4&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 06:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866916#M342388</guid>
      <dc:creator>Rub_Saifi</dc:creator>
      <dc:date>2023-03-29T06:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS VIYA :- FEDSQL SUBQUERY ERROR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866984#M342400</link>
      <description>&lt;P&gt;Without knowing more details about your data and specific business logic to be achieved, it's hard to tell how to rewrite the query.&lt;/P&gt;
&lt;P&gt;Alternatives could be using EXISTS or some kind of inner join logic?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 13:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-VIYA-FEDSQL-SUBQUERY-ERROR/m-p/866984#M342400</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-03-29T13:42:32Z</dc:date>
    </item>
  </channel>
</rss>

