ST_ALTER_SRS procedure

Use this stored procedure to update a spatial reference system definition in the database. When this stored procedure is processed, information about the spatial reference system is updated in the DB2GSE.ST_SPATIAL_REFERENCE_SYSTEMS catalog view.

Internally, Db2® Spatial Extender stores the coordinate values as positive integers. Thus during computation, the impact of rounding errors (which are heavily dependent on the actual value for floating-point operations) can be reduced. Performance of the spatial operations can also improve significantly.

Restriction: You cannot alter a spatial reference system if a registered spatial column uses that spatial reference system.
Attention: Use care with this stored procedure. If you use this stored procedure to change offset, scale, or coordsys_name parameters of the spatial reference system, and if you have existing spatial data that is associated with the spatial reference system, you might inadvertently change the spatial data. If spatial data is affected, you are responsible for ensuring that the changed spatial data is still accurate and valid.

Authorization

The user ID under which the stored procedure is invoked must have DBADM authority.

Syntax

Read syntax diagramSkip visual syntax diagramDB2GSE.ST_ALTER_SRS(srs_name,srs_idnull,x_offsetnull,x_scalenull,y_offsetnull,y_scalenull,z_offsetnull,z_scalenull,m_offsetnull,m_scalenull,coordsys_namenull,descriptionnull, msg_code , msg_text )

Parameter descriptions

srs_name
Identifies the spatial reference system. 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).

srs_id
Uniquely identifies the spatial reference system. This identifier is used as an input parameter for various spatial functions. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the numeric identifier of the spatial reference system is not changed.

The data type of this parameter is INTEGER.

x_offset
Specifies the offset for all X coordinates of geometries that are represented in this spatial reference system. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value for this parameter in the definition of the spatial reference system is not changed.

The offset is subtracted before the scale factor x_scale is applied when geometries are converted from external representations (WKT, WKB, shape) to the Db2 Spatial Extender internal representation. (WKT is well-known text, and WKB is well-known binary.)

The data type of this parameter is DOUBLE.

x_scale
Specifies the scale factor for all X coordinates of geometries that are represented in this spatial reference system. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value for this parameter in the definition of the spatial reference system is not changed.

The scale factor is applied (multiplication) after the offset x_offset is subtracted when geometries are converted from external representations (WKT, WKB, shape) to the Db2 Spatial Extender internal representation.

The data type of this parameter is DOUBLE.

y_offset
Specifies the offset for all Y coordinates of geometries that are represented in this spatial reference system. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value for this parameter in the definition of the spatial reference system is not changed.

The offset is subtracted before the scale factor y_scale is applied when geometries are converted from external representations (WKT, WKB, shape) to the Db2 Spatial Extender internal representation.

The data type of this parameter is DOUBLE.

y_scale
Specifies the scale factor for all Y coordinates of geometries that are represented in this spatial reference system. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value for this parameter in the definition of the spatial reference system is not changed.

The scale factor is applied (multiplication) after the offset y_offset is subtracted when geometries are converted from external representations (WKT, WKB, shape) to the Db2 Spatial Extender internal representation. This scale factor must be the same as x_scale.

The data type of this parameter is DOUBLE.

z_offset
Specifies the offset for all Z coordinates of geometries that are represented in this spatial reference system. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value for this parameter in the definition of the spatial reference system is not changed.

The offset is subtracted before the scale factor z_scale is applied when geometries are converted from external representations (WKT, WKB, shape) to the Db2 Spatial Extender internal representation.

The data type of this parameter is DOUBLE.

z_scale
Specifies the scale factor for all Z coordinates of geometries that are represented in this spatial reference system. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value for this parameter in the definition of the spatial reference system is not changed.

The scale factor is applied (multiplication) after the offset z_offset is subtracted when geometries are converted from external representations (WKT, WKB, shape) to the Db2 Spatial Extender internal representation.

The data type of this parameter is DOUBLE.

m_offset
Specifies the offset for all M coordinates of geometries that are represented in this spatial reference system. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value for this parameter in the definition of the spatial reference system is not changed.

The offset is subtracted before the scale factor m_scale is applied when geometries are converted from external representations (WKT, WKB, shape) to the Db2 Spatial Extender internal representation.

The data type of this parameter is DOUBLE.

m_scale
Specifies the scale factor for all M coordinates of geometries that are represented in this spatial reference system. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value for this parameter in the definition of the spatial reference system is not changed.

The scale factor is applied (multiplication) after the offset m_offset is subtracted when geometries are converted from external representations (WKT, WKB, shape) to the Db2 Spatial Extender internal representation.

The data type of this parameter is DOUBLE.

coordsys_name
Uniquely identifies the coordinate system on which this spatial reference system is based. The coordinate system must be listed in the view ST_COORDINATE_SYSTEMS. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the coordinate system that is used for this spatial reference system is not changed.

The coordsys_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).

description
Describes the spatial reference system by explaining its application. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the description information about the spatial reference system is not changed.

The data type of this parameter is VARCHAR(256).

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_ALTER_SRS stored procedure. This example uses a Db2 CALL command to change the description parameter value of a spatial reference system named SRSDEMO:

call DB2GSE.ST_ALTER_SRS('SRSDEMO',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
     NULL,NULL,'SRS for GSE Demo Program: offices table',?,?)

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.