Im trying to copy over data from one table to another in the same db2 database, using this command:
INSERT INTO SCH.TAB1 (SOMEPK, GEOM)
SELECT SOMEPK, db2gse.ST_Geometry(GEOM) FROM SCH.TAB2
The 2 tables are identical except that TAB2 GEOM column is of st_geometry data type while the same column in TAB1 is VAR-CHAR however I want to convert the data in the GEOM
column from text to st_geometry
format when I'm copying across, however I get the following error:
SQL0408N A value is not compatible with the data type of its assignment target. Target name is "GEOM ".
Explanation:
The data type of the value to be assigned to the column, parameter, SQL
variable, or transition variable by the SQL statement is incompatible
with the declared data type of the assignment target.
The statement cannot be processed.
User response:
Examine the statement and possibly the target table or view to determine
the target data type. Ensure the variable, expression, or literal value
assigned has the proper data type for the assignment target.
For a user-defined structured type, also consider the parameter of the
TO SQL transform function defined in the transform group for the
statement as an assignment target.
sqlcode: -408