15.10 - MBB - Teradata Database

Teradata Database SQL Geospatial Types

Teradata Database
Programming Reference

Defines the minimum sized box that can surround a 3D geometry.

Use the following syntax to specify an MBB data type in a column definition.


Syntax element …

Specifies …


the database that contains the definition of the Teradata Database MBR data type.




A column defined as data type MBB supports the following data type attributes:

  • NULL
  • For more information on using these data type attributes, see SQL Data Types and Literals.

    An MBB column does not support column storage or column constraint attributes.

    Client applications can use a VARCHAR to insert a value into an MBB column. The VARCHAR must have the following format:

       (xmin, ymin, zmin, xmax, ymax, zmax)

    where white space can appear anywhere.

    For queries that select data from an MBB column, Teradata Database returns the MBB data as a VARCHAR(340) using the same format (xmin, ymin, xmax, ymax).

    Consider the following definition of a table that defines an MBB column.

       CREATE TABLE sample_MBBs (skey INTEGER, shape_mbb MBB);

    A query that selects data from the shape_mbr column results in Teradata Database returning the column data as a VARCHAR(340):

       SELECT * 
       FROM sample_MBBs;
       SKEY          SHAPE_MBB
       --------      -------------
       1002          (10, 3, 1, 22, 7, 2)

    Teradata Database implements cast functionality that allows data type conversions between VARCHAR and MBB types. To convert a VARCHAR type to an MBB type, the VARCHAR must use the following format:

       (xmin, ymin, zmin, xmax, ymax, zmax)

    where white space can appear anywhere.

    Consider the following table definitions.

       CREATE TABLE sample_MBBs (skey INTEGER, shape_mbb MBB);
       CREATE TABLE sample_data (mbb_data VARCHAR(340));

    This example performs MBR to VARCHAR data type conversion:

       INSERT INTO sample_data 
       SELECT CAST(shape_mbb as VARCHAR(340))
       FROM sample_MBBs;

    The MBB data type is defined with an inherent ordering scheme. In general, however, ordering MBR types is not useful or meaningful.