Im trying to copy over data from one table to another in the same db2 database, using this command:
我试图在同一个db2数据库中使用这个命令将数据从一个表复制到另一个表:
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:
这两个表是相同的,除了TAB2 GEOM列是st_geometry数据类型,而TAB1中的同一列是VAR-CHAR,但是我想在复制时将GEOM列中的数据从文本转换为st_geometry格式,但是我得到了以下错误:
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
1 个解决方案
#1
0
This is for an older version of DB2 but it looks like it might work. The ST_GeomFromText function.
这是针对较旧版本的DB2,但看起来可能有用。ST_GeomFromText函数。
See also this link.
也看到这个链接。
#1
0
This is for an older version of DB2 but it looks like it might work. The ST_GeomFromText function.
这是针对较旧版本的DB2,但看起来可能有用。ST_GeomFromText函数。
See also this link.
也看到这个链接。