15.10 - MBR - Teradata Database

Teradata Database SQL Geospatial Types

prodname
Teradata Database
vrm_release
15.10
category
Programming Reference
featnum
B035-1181-151K

Defines the minimum sized rectangle that can surround a 2D geometry.

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

 

Syntax element …

Specifies …

SYSUDTLIB.

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

attribute

 

 

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

  • NULL
  • NOT NULL
  • FORMAT
  • TITLE
  • NAMED
  • DEFAULT NULL
  • For more information on using these data type attributes, see SQL Data Types and Literals.

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

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

       (xmin, ymin, xmax, ymax)

    where white space can appear anywhere.

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

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

       CREATE TABLE sample_MBRs (skey INTEGER, shape_mbr MBR);

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

       SELECT * 
       FROM sample_MBRs;
     
       SKEY          SHAPE_MBR
       --------      -------------
       1001          (10, 3, 22, 7)

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

       (xmin, ymin, xmax, ymax)

    where white space can appear anywhere.

    Consider the following table definitions.

       CREATE TABLE sample_MBRs (skey INTEGER, shape_mbr MBR);
       CREATE TABLE sample_data (mbr_data VARCHAR(256));
     

    This example performs MBR to VARCHAR data type conversion:

       INSERT INTO sample_data 
       SELECT CAST(shape_mbr as VARCHAR(256))
       FROM sample_MBRs;

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