DB2 Version 9.7 for Linux, UNIX, and Windows

ST_register_spatial_column

Use this stored procedure to register a spatial column and to associate a spatial reference system (SRS) with it.

You can also use this stored procedure to compute the geographic extents of the spatial column.

After this stored procedure is processed, information about the registered spatial column and geographic extents is available from the DB2GSE.ST_GEOMETRY_COLUMNS catalog view. Registering a spatial column creates a constraint on the table, if possible, to ensure that all geometries use the specified SRS.

Authorization

The user ID under which this stored procedure is invoked must hold one of the following authorities or privileges:
  • DBADM authority on the database that contains the table to which the spatial column that is being registered belongs
  • CONTROL privilege on this table
  • ALTER privilege on this table

Syntax

Read syntax diagramSkip visual syntax diagram
>>-db2gse.ST_register_spatial_column--(--+-table_schema-+--,---->
                                         '-null---------'      

>--table_name--,--column_name--,--srs_name--,------------------->

>--+-----------------+--)--------------------------------------><
   +-compute_extents-+      
   '-null------------'      

Parameter descriptions

table_schema
Names the schema to which the table or view that is specified in the table_name parameter belongs. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value in the CURRENT SCHEMA special register is used as the schema name for the table or view.

The table_schema value is converted to uppercase unless you enclose it in double quotation marks.

The data type of this parameter is VARCHAR(128) or, if you enclose the value in double quotation marks, VARCHAR(130).

table_name
Specifies the unqualified name of the table or view that contains the column that is being registered. You must specify a non-null value for this parameter.

The table_name value is converted to uppercase unless you enclose it in double quotation marks.

The data type of this parameter is VARCHAR(128) or, if you enclose the value in double quotation marks, VARCHAR(130).

column_name
Names the column that is being registered. You must specify a non-null value for this parameter.

The column_name value is converted to uppercase unless you enclose it in double quotation marks.

The data type of this parameter is VARCHAR(128) or, if you enclose the value in double quotation marks, VARCHAR(130).

srs_name
Names the spatial reference system that is to be used for this spatial column. You must specify a non-null value for this parameter.

The srs_name value is converted to uppercase unless you enclose it in double quotation marks.

The data type of this parameter is VARCHAR(128) or, if you enclose the value in double quotation marks, VARCHAR(130).

compute_extents
Indicates whether to compute the geographic extents of a specified column and make them available through the DB2GSE.ST_GEOMETRY_COLUMNS catalog view. The possible values for this parameter are:
  • A value greater than 0 to compute the geographic extents.
  • Null, 0, or a negative value to prevent this computation.

If you omit this parameter, it has the same effect as specifying 0. The extent computation is not performed.

The data type of this parameter is INTEGER.

Output parameters

msg_code
Specifies the message code that is returned from the stored procedure. The value of this output parameter identifies the error, success, or warning condition that was encountered during the processing of the procedure. If this parameter value is for a success or warning condition, the procedure finished its task. If the parameter value is for an error condition, no changes to the database were performed.

The data type of this output parameter is INTEGER.

msg_text
Specifies the actual message text, associated with the message code, that is returned from the stored procedure. The message text can include additional information about the success, warning, or error condition, such as where an error was encountered.

The data type of this output parameter is VARCHAR(1024).

Example

This example shows how to use the DB2® command line processor to invoke the ST_register_spatial_column stored procedure. This example uses a DB2 CALL command to register the spatial column named LOCATION in the table named CUSTOMERS. This CALL command specifies the srs_name parameter value as USA_SRS_1:
call db2gse.ST_register_spatial_column(NULL,'CUSTOMERS','LOCATION',
     'USA_SRS_1',?,?)

The two question marks at the end of this CALL command represent the output parameters, msg_code and msg_text. The values for these output parameters are displayed after the stored procedure runs.