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.4.2

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    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.4.2
    iconOceanBase Database
    SQL - V 4.4.2
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • 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

    SDO_GEOMETRY constructor functions

    Last Updated:2026-04-14 12:43:57  Updated
    Share
    What is on this page
    Syntax of SDO_GEOMETRY()
    Create a SDO_GEOMETRY object by using the default constructor function
    Create a SDO_GEOMETRY object from WKB data
    Create a SDO_GEOMETRY object from WKT data

    folded

    Share

    OceanBase Database in Oracle-compatible mode allows you to create spatial objects of the SDO_GEOMETRY type by using the default function SDO_GEOMETRY() from well-known text (WKT) or well-known binary (WKB) data.

    Syntax of SDO_GEOMETRY()

    SDO_GEOMETRY({to_blob('wkb_value') | 'wkt_value'} [, srid])
    

    The parameters are described as follows:

    • wkb_value: a geometry object in the WKB format. The value is a binary string that describes the type and coordinate data of the geospatial object. For example, 0101000000000000000000F03F000000000000F03F is the WKB value of a Point object.

    • wkt_value: a geometry object in the WKT format. The value is a text string that describes the type and coordinate data of the geospatial object. Here are some examples:

      • POINT(1.0 1.0) represents a Point object.
      • LINESTRING(0 0, 1 1, 2 2) represents a LineString object that consists of three points.
      • POLYGON((0 0, 0 1, 1 1, 1 0, 0 0)) represents a Polygon object in the form of a closed rectangle.
      • MULTILINESTRING((0 0, 1 1, 2 2), (3 3, 4 4, 5 5)) represents a MultiLineString object that consists of two line segments.
      • MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)), ((2 2, 2 3, 3 3, 3 2, 2 2))) represents a MultiPolygon object that consists of two polygons.
      • GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(1 1, 2 2)) represents a GeometryCollection object that consists of a Point object and a LineString object.
    • srid: the spatial reference identifier (SRID), which specifies the spatial reference system (SRS) used by the geometry object. This parameter is optional. The default value is NULL. The value of srid is an integer.

    Note

    wkb_value and wkt_value values must be enclosed in single quotation marks (' ').

    Create a SDO_GEOMETRY object by using the default constructor function

    Create a SDO_GEOMETRY object from WKB data

    Create a SDO_GEOMETRY object by using the SDO_GEOMETRY() function from WKB data.

    Here is an example:

    Execute the following query statement to convert a binary string into a SDO_GEOMETRY object and name the object as TEST_SDO_GEOMETRY in the query result. In the query statement, TO_BLOB() converts the binary string 01010000000000000000000000000000000000F03F into BLOB data and SDO_GEOMETRY() creates a SDO_GEOMETRY object from the data.

    obclient [SYS]> SELECT SDO_GEOMETRY(to_blob('01010000000000000000000000000000000000F03F'), null) AS TEST_SDO_GEOMETRY FROM dual;
    

    The return result is as follows:

    +------------------------------------------------------------------+
    | TEST_SDO_GEOMETRY                                                |
    +------------------------------------------------------------------+
    | SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(0, 1, NULL), NULL, NULL) |
    +------------------------------------------------------------------+
    1 row in set
    

    Create a SDO_GEOMETRY object from WKT data

    Create a SDO_GEOMETRY object by using the SDO_GEOMETRY() function from WKT data.

    Here is an example:

    Execute the following query statement to create a SDO_GEOMETRY object named TEST_SDO_GEOMETRY and set it as a 2D Point object. The SDO_GEOMETRY() function creates a spatial object of the SDO_GEOMETRY type. POINT(-1e5 1e-3) is a WKT string that represents a 2D Point object, where -1e5 indicates that the X coordinate of the point is -100000, and 1e-3 indicates that the Y coordinate of the point is 0.001.

    obclient [SYS]> SELECT SDO_GEOMETRY('POINT(-1e5 1e-3)', null) AS TEST_SDO_GEOMETRY FROM dual;
    

    The return result is as follows:

    +----------------------------------------------------------------------------+
    | TEST_SDO_GEOMETRY                                                          |
    +----------------------------------------------------------------------------+
    | SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(-100000, 0.001, NULL), NULL, NULL) |
    +----------------------------------------------------------------------------+
    1 row in set
    

    Previous topic

    Overview
    Last

    Next topic

    Spatial query functions
    Next
    What is on this page
    Syntax of SDO_GEOMETRY()
    Create a SDO_GEOMETRY object by using the default constructor function
    Create a SDO_GEOMETRY object from WKB data
    Create a SDO_GEOMETRY object from WKT data