Search notes:

Oracle SQL Plan operation: POLYMORPHIC TABLE FUNCTION

create or replace package tq84_ptf_pkg authid definer as

   function describe(tab in out dbms_tf.table_t) return dbms_tf.describe_t;
   
   procedure fetch_rows;

end tq84_ptf_pkg;
/
create or replace package body tq84_ptf_pkg as

   function describe(tab in out dbms_tf.table_t) return dbms_tf.describe_t
   is begin
      return null;
   end describe;
 
   procedure fetch_rows as
      rowset dbms_tf.row_set_t;
   begin
      dbms_tf.get_row_set(rowset);
      dbms_tf.put_row_set(rowset);
   end fetch_rows;

end tq84_ptf_pkg;
/
create or replace function tq84_ptf(tab table) return table pipelined row polymorphic using tq84_ptf_pkg;
/
create table tq84_tab(n number, t varchar2(10));
explain plan for
select * from tq84_ptf(tq84_tab);

select * from dbms_xplan.display();
--
-- ----------------------------------------------------------------------------------------
-- | Id  | Operation                   | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
-- ----------------------------------------------------------------------------------------
-- |   0 | SELECT STATEMENT            |          |     1 |    20 |     2   (0)| 00:00:01 |
-- |   1 |  POLYMORPHIC TABLE FUNCTION | TQ84_PTF |     1 |    20 |            |          |
-- |   2 |   TABLE ACCESS FULL         | TQ84_TAB |     1 |    20 |     2   (0)| 00:00:01 |
-- ----------------------------------------------------------------------------------------
--  
-- Polymorphic Table Function
-- ------------------------------------------------------
--  
--    1 - type = row, Pass Through Columns = (N, T)
Note

See also

Polymorphic table functions
Plan operations

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199200, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL/statement/execution/plan/operations/polymorphic-table-function(94): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78