title: DB2 SQL Function with dynamic return value
body: <p>I have the following working DB2 SQL function </p>
  
  <pre><code>CREATE OR REPLACE FUNCTION selector (param VARCHAR(3))
  RETURNS TABLE (id INT, CMD VARCHAR(1024), ATTR CHAR(10))
  LANGUAGE SQL 
  DETERMINISTIC
  NO EXTERNAL ACTION 
  RETURN
    SELECT id, cmd, attr
        FROM test.commandtbl c
        WHERE c.attr=param;
  </code></pre>
  
  <p>Calling it like:</p>
  
  <pre><code>select * from table (selector('c'))!      
  </code></pre>
  
  <p>The problem is that I want the return table to be dynamic in size and type. 
  I want to use the function with a lot of return fields and and while testing I don't want to always check the return table it everything still matches. </p>
  
  <p>For example:</p>
  
  <p>Test1 is with 5 return columns: INT, INT, INT, CHAR(10), VARCHAR(100)</p>
  
  <p>Test2 is with 20 return columns: 10 VARCHAR(100) and 10 INT</p>
  
  <p>and so on. </p>
  
  <p>Is there a way to do that?</p>