OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Database

SQL - V4.6.0

    Download PDF

    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.6.0

    Hierarchical query operators

    Last Updated:2026-09-03 07:31:11

    PRIOR operator
    CONNECT_BY_ROOT operator

    The hierarchical query operators include PRIOR and CONNECT_BY_ROOT. These two operators are valid only in hierarchical queries.

    PRIOR operator

    In a hierarchical query, the CONNECT BY condition must include at least one expression that is prefixed with the PRIOR operator. The result of the PRIOR operator is obtained by using the parent row of the current row to calculate the subsequent expression.

    The PRIOR operator is most commonly used in scenarios involving equality comparisons between columns (it can appear on either side of the comparison operator). Theoretically, other operators besides the equality operator (=) can be used in the CONNECT BY clause. However, conditions created using these other operators may result in cycles. In such cases, OceanBase Database will detect the cycle at runtime and return an error.

    CONNECT_BY_ROOT operator

    CONNECT_BY_ROOT is a unary operator that is valid only in hierarchical queries. The parameter of CONNECT_BY_ROOT can be a column or most expressions. The result of the CONNECT_BY_ROOT operator is obtained by using the data of the root row to calculate the value of the parameter.

    Notice

    You cannot specify this operator in the START WITH or CONNECT BY conditions.

    For more information about hierarchical queries, see Hierarchical queries.

    on this page
    PRIOR operator
    CONNECT_BY_ROOT operator