OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.5

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.5
    iconOceanBase Database
    SQL - V 4.3.5
    SQL
    KV
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Create a pipelined table function

    Last Updated:2026-04-15 06:09:08  Updated
    share
    What is on this page
    Main syntaxes
    Syntax description
    Data types of return values
    Examples

    folded

    share

    A pipelined table function must be a standalone function or a package function. This topic describes how to create a pipelined table function.

    Applicability

    This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.

    Main syntaxes

    For more information, see CREATE FUNCTION. The syntax of pipelined_clause is as follows:

    PIPELINED
    { [ USING [schema.] implementation_type ]
    | { ROW | TABLE } POLYMORPHIC [ USING [schema.] implementation_package ]
    }
    

    The syntax of PIPE ROW is as follows:

    PIPE ROW ( row ) ;
    

    The syntax of parallel_enable_clause is as follows:

    PARALLEL_ENABLE
    [ (PARTITION argument BY
        { ANY
        | { HASH | RANGE } (column [, column ]...) [ streaming_clause ]
        | VALUE (column)
        }
      )
    

    The syntax of return_statement is as follows:

    RETURN [ expression ] ;
    

    Syntax description

    • If the pipelined table function is a standalone function, specify the PIPELINED option in the CREATE FUNCTION statement. If the pipelined table function is a package function, specify the PIPELINED option in both the function declaration and the function definition.

    • We recommend that you specify the PARALLEL_ENABLE option to enable the pipelined table function for parallel execution.

    • If the pipelined table function executes DML statements, specify the PRAGMA AUTONOMOUS_TRANSACTION; option to make the function autonomous. Then each instance of the function creates a separate transaction during parallel execution.

    • Calling a pipelined table function multiple times in one query or in separate queries results in multiple executions of the underlying implementation. If the function is deterministic, specify the DETERMINISTIC option.

    • A pipelined table function usually has one or more cursor variables. For more information about cursor variables, see Cursor variables.

    • In a pipelined table function, the PIPE ROW statement returns collection elements to the caller without returning the right of control.

    • Each execution path in the function must point to a RETURN statement that returns the right of control to the caller. However, the RETURN statement does not need to return values to the caller.

    Data types of return values

    The return value of a pipelined table function must be a collection defined in the schema or package, and cannot be an associative array. Elements of a collection must be of SQL data types, but not data types supported only by PL, such as the PLS_INTEGER and BOOLEAN data types.

    You can use SQL data types ANYTYPE and ANYDATA to dynamically encapsulate and access descriptions, data instances, and data instance sets of any other SQL data types (including objects and collections).

    Examples

    obclient> CREATE OR REPLACE PACKAGE pkg_pi AUTHID DEFINER AS
            TYPE numset_tbl IS TABLE OF NUMBER;
            FUNCTION fuc(n NUMBER) RETURN numset_tbl PIPELINED;
          END pkg_pi;
          /
    Query OK, 0 rows affected
    
    obclient> CREATE OR REPLACE PACKAGE BODY pkg_pi AS
            FUNCTION fuc(n NUMBER) RETURN numset_tbl PIPELINED IS
            BEGIN
              FOR i IN 1..n LOOP
                PIPE ROW(i);
              END LOOP;
              RETURN;
            END fuc;
          END pkg_pi;
          /
    Query OK, 0 rows affected
    
    obclient> SELECT * FROM TABLE(pkg_pi.fuc(6));
    +--------------+
    | COLUMN_VALUE |
    +--------------+
    |            1 |
    |            2 |
    |            3 |
    |            4 |
    |            5 |
    |            6 |
    +--------------+
    5 rows in set
    
    obclient> SELECT * FROM TABLE(pkg_pi.fuc(3));
    +--------------+
    | COLUMN_VALUE |
    +--------------+
    |            1 |
    |            2 |
    |            3 |
    +--------------+
    2 rows in set
    

    Previous topic

    Overview
    Last

    Next topic

    Application
    Next
    What is on this page
    Main syntaxes
    Syntax description
    Data types of return values
    Examples