title: How can I return a SELECT query with an oracle function?
body: <p>I need to create a function that allows me to return the same result as a SELECT query and that contains pl/sql code.</p>
  <p>I tried something really simple :</p>
  <pre class="lang-sql prettyprint-override"><code>create or replace FUNCTION test
    RETURN SYS_REFCURSOR
  IS
    l_rc SYS_REFCURSOR;
  BEGIN
    OPEN l_rc
     FOR SELECT *
           FROM my_table;
    RETURN l_rc;
  END;
  </code></pre>
  <p>But when I call my function with <code>SELECT test from dual;</code>, I get all result from <code>my_table</code> in a single cell instead of having each columns separated.</p>
  <p>Is there a way of doing what I want ?</p>
  <p>Ideally, I want a view but there seems to be no way of adding logical conditions with them.</p>