This example creates a PTF called noop. This is a minimalist use case of a client interface.
CREATE PACKAGE noop_package
AS
FUNCTION describe(t IN OUT DBMS_TF.table_t)
RETURN DBMS_TF.describe_t;
PROCEDURE fetch_rows;
END noop_package;
Package created.
CREATE PACKAGE BODY noop_package
AS
FUNCTION describe(t IN OUT DBMS_TF.table_t)
RETURN DBMS_TF.describe_t AS
BEGIN
RETURN NULL;
END;
PROCEDURE fetch_rows
AS
BEGIN
RETURN;
END;
END noop_package;
Package Body created.
CREATE FUNCTION noop (t TABLE)
RETURN TABLE PIPELINED ROW POLYMORPHIC USING noop_package;
Function created.
SELECT *
FROM noop(scott.emp)
WHERE deptno =10
EMPNO | ENAME | JOB | MGR | HIREDATE | SAL | COMM | DEPTNO | 7839 | KING | PRESIDENT | - | 17-NOV-81 | 5000 | - | 10 | 7782 | CLARK | MANAGER | 7839 | 09-JUN-81 | 2450 | - | 10 | 7934 | MILLER | CLERK | 7782 | 23-JAN-82 | 1300 | - | 10 |
---|
WITH e
AS (SELECT *
FROM scott.emp
NATURAL JOIN scott.dept
WHERE dname = 'SALES')
SELECT t.*
FROM noop(e) t
DEPTNO | EMPNO | ENAME | JOB | MGR | HIREDATE | SAL | COMM | DNAME | LOC | 30 | 7521 | WARD | SALESMAN | 7698 | 22-FEB-81 | 1250 | 500 | SALES | CHICAGO | 30 | 7654 | MARTIN | SALESMAN | 7698 | 28-SEP-81 | 1250 | 1400 | SALES | CHICAGO | 30 | 7844 | TURNER | SALESMAN | 7698 | 08-SEP-81 | 1500 | 0 | SALES | CHICAGO | 30 | 7900 | JAMES | CLERK | 7698 | 03-DEC-81 | 950 | - | SALES | CHICAGO | 30 | 7499 | ALLEN | SALESMAN | 7698 | 20-FEB-81 | 1600 | 300 | SALES | CHICAGO | 30 | 7698 | BLAKE | MANAGER | 7839 | 01-MAY-81 | 2850 | - | SALES | CHICAGO |
---|