<?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 Oracle WITH for functions not working in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006898#M11658</link>
    <description>&lt;P&gt;I'm trying to execute this SQL from Qlik Sense:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WITH
    FUNCTION TO_ISO8601(datetime IN DATE, timezone IN VARCHAR2) RETURN VARCHAR2 IS
            BEGIN
                RETURN
                    TO_CHAR(
                        CAST(datetime AS TIMESTAMP) AT TIME ZONE timezone,
                        'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM'
                    );
            END;
        
SELECT
    TO_ISO8601(sysdate, 'Europe/Stockholm')
    
FROM
    DUAL
;&lt;/LI-CODE&gt;
&lt;P&gt;But I keep getting&amp;nbsp; this error:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ERROR [HY000] [Qlik][OracleOCI] (3000) Oracle Caller Interface: ORA-00905: missing keyword&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I can run it with no problems in SQL Developer.&lt;/P&gt;
&lt;P&gt;Could it be that the Qlik ODBC Connector doesn't allow defining functions within the WITH clause?&lt;BR /&gt;Regular subqueries work fine within WITH.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2022 09:32:48 GMT</pubDate>
    <dc:creator>mattias-thalen</dc:creator>
    <dc:date>2022-11-21T09:32:48Z</dc:date>
    <item>
      <title>Oracle WITH for functions not working</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006898#M11658</link>
      <description>&lt;P&gt;I'm trying to execute this SQL from Qlik Sense:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WITH
    FUNCTION TO_ISO8601(datetime IN DATE, timezone IN VARCHAR2) RETURN VARCHAR2 IS
            BEGIN
                RETURN
                    TO_CHAR(
                        CAST(datetime AS TIMESTAMP) AT TIME ZONE timezone,
                        'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM'
                    );
            END;
        
SELECT
    TO_ISO8601(sysdate, 'Europe/Stockholm')
    
FROM
    DUAL
;&lt;/LI-CODE&gt;
&lt;P&gt;But I keep getting&amp;nbsp; this error:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ERROR [HY000] [Qlik][OracleOCI] (3000) Oracle Caller Interface: ORA-00905: missing keyword&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I can run it with no problems in SQL Developer.&lt;/P&gt;
&lt;P&gt;Could it be that the Qlik ODBC Connector doesn't allow defining functions within the WITH clause?&lt;BR /&gt;Regular subqueries work fine within WITH.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 09:32:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006898#M11658</guid>
      <dc:creator>mattias-thalen</dc:creator>
      <dc:date>2022-11-21T09:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle WITH for functions not working</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006908#M11659</link>
      <description>&lt;P&gt;You would need to allow non-select queries if you want to use WITH. See:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/connectors/Subsystems/ODBC_connector_help/Content/Connectors_ODBC/How-to-load-without-SELECT.htm" target="_blank"&gt;https://help.qlik.com/en-US/connectors/Subsystems/ODBC_connector_help/Content/Connectors_ODBC/How-to-load-without-SELECT.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 09:44:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006908#M11659</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2022-11-21T09:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle WITH for functions not working</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006944#M11661</link>
      <description>&lt;P&gt;I have, hence "&lt;SPAN&gt;Regular subqueries work fine within WITH." &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Working:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WITH
    tz_table AS
        (
            SELECT
                1 AS tz_id
            ,   'Europe/Stockholm' AS timezone
            FROM
                DUAL
        )
,   timetable AS
        (
            SELECT
                1 AS tz_id
            ,   sysdate AS sys_date
            
            FROM
                dual
        )
    
        
SELECT
    TO_ISO8601(tt.sys_date, tz.timezone)
    
FROM
    timetable tt
    
    LEFT JOIN tz_table tz
        ON tz.tz_id = tt.tz_id
;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not working:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WITH
    FUNCTION TO_ISO8601(datetime IN DATE, timezone IN VARCHAR2) RETURN VARCHAR2 IS
            BEGIN
                RETURN
                    TO_CHAR(
                        CAST(datetime AS TIMESTAMP) AT TIME ZONE timezone,
                        'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM'
                    );
            END;
    
    tz_table AS
        (
            SELECT
                1 AS tz_id
            ,   'Europe/Stockholm' AS timezone
            FROM
                DUAL
        )
,   timetable AS
        (
            SELECT
                1 AS tz_id
            ,   sysdate AS sys_date
            
            FROM
                dual
        )
    
        
SELECT
    TO_ISO8601(tt.sys_date, tz.timezone)
    
FROM
    timetable tt
    
    LEFT JOIN tz_table tz
        ON tz.tz_id = tt.tz_id
;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Nov 2022 10:43:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006944#M11661</guid>
      <dc:creator>mattias-thalen</dc:creator>
      <dc:date>2022-11-21T10:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle WITH for functions not working</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006946#M11662</link>
      <description>&lt;P&gt;Apologies - I missed that last part. Unfortunately, I have no idea as to the answer for what you're actually asking, so I'm no help here...&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 11:24:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006946#M11662</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2022-11-21T11:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle WITH for functions not working</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006953#M11663</link>
      <description>&lt;P&gt;No worries &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'm asking how to make declarations of functions within a WITH clause work in Qlik.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 11:14:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Oracle-WITH-for-functions-not-working/m-p/2006953#M11663</guid>
      <dc:creator>mattias-thalen</dc:creator>
      <dc:date>2022-11-21T11:14:34Z</dc:date>
    </item>
  </channel>
</rss>

