ST_create_coordsys

Use this stored procedure to store information in the database about a new coordinate system.

When this stored procedure is processed, information about the coordinate system is added to the DB2GSE.ST_COORDINATE_SYSTEMS catalog view.

Authorization

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

Syntax

Read syntax diagramSkip visual syntax diagramsysproc.ST_create_coordsys( coordsys_name,definition,organizationnull,organization_coordsys_idnull,descriptionnull,msg_code,msg_text)

Parameter descriptions

coordsys_name
Uniquely identifies the coordinate system. You must specify a non-null value for this parameter.

Specify the coordsys_name value in uppercase letters.

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

definition
Defines the coordinate system. You must specify a non-null value for this parameter. The vendor that supplies the coordinate system usually provides the information for this parameter.

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

organization
Identifies the organization that defined the coordinate system and provided the definition for it; for example, "European Petroleum Survey Group (EPSG)." Although you must specify a value for this parameter, the value can be null.

If this parameter is null, the organization_coordsys_id parameter must also be null. If this parameter is not null, the organization_coordsys_id parameter cannot be null; in this case, the combination of the organization and organization_coordsys_id parameters uniquely identifies the coordinate system.

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

organization_coordsys_id
Specifies a numeric identifier. The entity that is specified in the organization parameter assigns this value. This value is not necessarily unique across all coordinate systems. Although you must specify a value for this parameter, the value can be null.

If this parameter is null, the organization parameter must also be null. If this parameter is not null, the organization parameter cannot be null; in this case, the combination of the organization and organization_coordsys_id parameters uniquely identifies the coordinate system.

The data type of this parameter is INTEGER.

description
Describes the coordinate system by explaining its application. Although you must specify a value for this parameter, the value can be null. If this parameter is null, no description information about the coordinate system is recorded.

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(4096).

When the message code that is returned is 0 (zero), the message text parameter is set to null.

Example

This example shows how to use the Db2 CALL statement to invoke the ST_create_coordsys stored procedure. This example uses a Db2 CALL statement to create a coordinate system with the following parameter values:
  • coordsys_name parameter: NORTH_AMERICAN_TEST
  • definition parameter:
    
    GEOGCS["GCS_North_American_1983",
    DATUM["D_North_American_1983",
    SPHEROID["GRS_1980",6378137.0,298.257222101]],
    PRIMEM["Greenwich",0.0],
    UNIT["Degree",0.0174532925199433]]
    
  • organization parameter: EPSG
  • organization_coordsys_id parameter: 1001
  • description parameter: Test Coordinate Systems

call sysproc.ST_create_coordsys('NORTH_AMERICAN_TEST',
     'GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",
     SPHEROID["GRS_1980",6378137.0,298.257222101]],
     PRIMEM["Greenwich",0.0],UNIT["Degree",
     0.0174532925199433]]','EPSG',1001,'Test Coordinate Systems',?,?)

The two question marks at the end of this CALL statement represent the output parameters, msg_code and msg_text. The values for these output parameters are returned after the stored procedure is called.