title: Casting Oracle cursor row into user-defined record type for a pipelined function
body: <p>In my package, I have defined a <code>record</code> type and a corresponding <code>table</code> type. I then have a pipelined function that opens a cursor and attempts to pipe each result out. The problem is that it's giving me type mismatch errors. I tried to cast the cursor to my record type, but to no avail: What am I doing wrong?</p>
  
  <pre><code>create or replace package myTest as
    type myRec is record(
      id  integer,
      foo varchar2(10)
    );
    type myTable is table of myRec;
  
    function output() return myTable pipelined;
  end myTest;
  /
  
  create or replace package body myTest as
    function output() return myTable pipelined
    as
    begin
      for myCur in (
        select id, foo from someTable
      )
      loop
        pipe row(cast(myCur as myRec));
      end loop;
  
      return;
    end output;
  end myTest;
  /
  </code></pre>