<?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 Data via ODBC from Oracle stored procedure which returns ref cursor in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308275#M706609</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ralf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick reply, I will certainly try this next week at my client.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jan 2012 13:49:30 GMT</pubDate>
    <dc:creator>magavi_framsteg</dc:creator>
    <dc:date>2012-01-27T13:49:30Z</dc:date>
    <item>
      <title>Data via ODBC from Oracle stored procedure which returns ref cursor</title>
      <link>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308273#M706607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 18pt;"&gt;&lt;STRONG&gt;My client wants to load data via ODBC from an Oracle stored procedure which returns a ref cursor.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt;Is that possible?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The client uses:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Windows Server 2008 R2 x64&lt;/LI&gt;&lt;LI&gt;QlikView v11 IR&lt;/LI&gt;&lt;LI&gt;Oracle 10 and ODBC drivers&lt;/LI&gt;&lt;LI&gt;Oracle 11and ODBC drivers&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I successfully manage to load data from the procedure when using the Oracle native tool SQLPlus by doing like this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Declare variable&lt;/LI&gt;&lt;LI&gt;Fill the variable with recordset from query result&lt;/LI&gt;&lt;LI&gt;Print variable content&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Any help would be highly appreciated!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried all from the following threads without any bit of luck:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/154180#154180"&gt;http://community.qlik.com/message/154180#154180&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/154204#154204"&gt;http://community.qlik.com/message/154204#154204&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/14521#14521"&gt;http://community.qlik.com/message/14521#14521&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even my friend Google was unable to assist me.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.google.se/search?q=qlikview+oracle+cursor&amp;amp;ie=utf-8&amp;amp;oe=utf-8&amp;amp;aq=t&amp;amp;rls=org.mozilla:en-US:official&amp;amp;client=firefox-a"&gt;http://www.google.se/search?q=qlikview+oracle+cursor&amp;amp;ie=utf-8&amp;amp;oe=utf-8&amp;amp;aq=t&amp;amp;rls=org.mozilla:en-US:official&amp;amp;client=firefox-a&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems strange that it should be so different in Oracle.&lt;/P&gt;&lt;P&gt;Oracle is in fact one of the bigger DBMS:s in the world.&lt;/P&gt;&lt;P&gt;And ref cursors are used commonly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/21613"&gt;Magnus Åvitsland&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.framsteg.com" target="_blank"&gt;Framsteg Business Intelligence Corp.&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 11:09:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308273#M706607</guid>
      <dc:creator>magavi_framsteg</dc:creator>
      <dc:date>2012-01-26T11:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Data via ODBC from Oracle stored procedure which returns ref cursor</title>
      <link>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308274#M706608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Magnus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is a very interesting topic I have also asked around and had no solution. Now I dig a bit deeper into it and I've got a solution which might be interesting for you but has the following limitations:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. only a function call is working (not a SP)&lt;/P&gt;&lt;P&gt;2. it's using sys_refcursor instead of type REF CURSOR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've build the following test function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Oracle PL/SQL:&lt;/P&gt;&lt;P&gt;create or replace&lt;/P&gt;&lt;P&gt;function f_get_tables return sys_refcursor&lt;/P&gt;&lt;P&gt;AS&lt;/P&gt;&lt;P&gt;&amp;nbsp; c1 sys_refcursor;&lt;/P&gt;&lt;P&gt;BEGIN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN C1 FOR &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT TABLE_NAME FROM user_tables;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN C1;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which can be called in the QlikView Load Script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tables:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQL { ? = call f_get_tables() };&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usually this should work also with a stored procedure but in this case I've got an &lt;/P&gt;&lt;P&gt;ORA-01008: not all variables bound..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also interesting is that this statement (on sqldeveloper) gives back all values from all rows in one XML-like string:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select f_get_tables() from dual;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Ralf&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 13:31:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308274#M706608</guid>
      <dc:creator>rbecher</dc:creator>
      <dc:date>2012-01-27T13:31:40Z</dc:date>
    </item>
    <item>
      <title>Data via ODBC from Oracle stored procedure which returns ref cursor</title>
      <link>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308275#M706609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ralf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick reply, I will certainly try this next week at my client.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 13:49:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308275#M706609</guid>
      <dc:creator>magavi_framsteg</dc:creator>
      <dc:date>2012-01-27T13:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Data via ODBC from Oracle stored procedure which returns ref cursor</title>
      <link>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308276#M706610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again Ralf.&lt;/P&gt;&lt;P&gt;I tried your bold QV script code and got the same result as you - as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I could not try and make the SP a function and have it return a SYS_REFCURSOR instead of a REF CURSOR, because the client already decided we could use views instead. Good for us &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the problem remains, and I'm sure I will encounter the problem many times in the future.&lt;/P&gt;&lt;P&gt;It is very strange that the QV data layers doesn't work something like this instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Make ODBC/OLEDB (or other) connection&lt;/P&gt;&lt;P&gt;2. Submit query&lt;/P&gt;&lt;P&gt;3. If the query is something like SELECT StoredProcedure/Function from dual (and which returns some kind of (SYS)REF CURSOR), then the QV data layer should detect that the result set comes in the form of a variable CURSOR and do some magic.&lt;/P&gt;&lt;P&gt;3. Return result as if it was a standard query like SELECT * FROM TABLE/VIEW&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From a user (developer) perspective, I should not have to write a custom macro with VB Script to take care of the "special Oracle cursors" and have the macro create the QVD for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG&gt;&lt;EM&gt;Also interesting is that this statement (on sqldeveloper) gives back all values from all rows in one XML-like string:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;STRONG&gt;&lt;EM&gt;select f_get_tables() from dual;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;It seems that SQLDeveloper does just what I described above. In SQLPlus I need to declare a variable, put the SP result into the variable, then print the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;P&gt;To be continued...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/21613"&gt;Magnus Åvitsland&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.framsteg.com" target="_blank"&gt;Framsteg Business Intelligence Corp.&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Mar 2012 20:00:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308276#M706610</guid>
      <dc:creator>magavi_framsteg</dc:creator>
      <dc:date>2012-03-02T20:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Data via ODBC from Oracle stored procedure which returns ref cursor</title>
      <link>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308277#M706611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Magnus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your response. Maybe we can add this functionality in our JDBC Connector..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-wiki-small" href="http://community.qlik.com/docs/DOC-2438"&gt;http://community.qlik.com/docs/DOC-2438&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Ralf&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Mar 2012 21:32:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-via-ODBC-from-Oracle-stored-procedure-which-returns-ref/m-p/308277#M706611</guid>
      <dc:creator>rbecher</dc:creator>
      <dc:date>2012-03-02T21:32:23Z</dc:date>
    </item>
  </channel>
</rss>

