An example of a pipelined table function. : PIPELINED « Stored Procedure Function « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » Stored Procedure Function » PIPELINED 
An example of a pipelined table function.
  
SQL>
SQL>
SQL> CREATE TYPE MyType AS OBJECT (
  2    field1 NUMBER,
  3    field2 VARCHAR2(50));
  4  /


SQL>
SQL> CREATE or replace TYPE MyTypeList AS TABLE OF MyType;
  2  /

Type created.

SQL>
SQL> CREATE OR REPLACE FUNCTION PipelineMe
  2    RETURN MyTypeList PIPELINED AS
  3    v_MyType MyType;
  4  BEGIN
  5    FOR v_Count IN 1..20 LOOP
  6      v_MyType := MyType(v_Count, 'Ro' || v_Count);
  7      PIPE ROW(v_MyType);
  8    END LOOP;
  9    RETURN;
 10  END PipelineMe;
 11  /

Function created.

SQL>
SQL> SELECT *
  2    FROM TABLE(PipelineMe);

    FIELD1 FIELD2
---------- --------------------------------------------------
         Row 1
         Row 2
         Row 3
         Row 4
         Row 5
         Row 6
         Row 7
         Row 8
         Row 9
        10 Row 10
        11 Row 11
        12 Row 12
        13 Row 13
        14 Row 14
        15 Row 15
        16 Row 16
        17 Row 17
        18 Row 18
        19 Row 19
        20 Row 20

20 rows selected.

SQL>
SQL> DROP TYPE MyType;


SQL>
SQL>

   
  
Related examples in the same category
1.Using a pipelined table function.
2.pipelined returning value and table() function
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.