我使用 FME Workbench 将 ESRI 要素类导入 Oracle。通过 FME 导入时,我使用了原始的 ESRI SRID。现在表在 Oracle 中,我想更改元数据和 SRID 以匹配 Oracle 的。首先,我使用了以下代码,但它给了我一个错误,因为已经OTTAWAPROVRDS
存在USER_SDO_GEOM_METADATA
(我猜它是通过 FME 导入时自动添加的)
INSERT INTO USER_SDO_GEOM_METADATA
(TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES
('OTTAWAPROVRDS', 'GEOM',
MDSYS.SDO_DIM_ARRAY
( MDSYS.SDO_DIM_ELEMENT('X', -180, 180, 0.5),
MDSYS.SDO_DIM_ELEMENT('Y', -90, 90, 0.5)
),
8307
);
然后我使用以下代码仅更改 SRID
UPDATE USER_SDO_GEOM_METADATA a
SET a.SRID = 8307
WHERE a.TABLE_NAME = 'OTTAWAPROVRDS';
这有效,但是当我尝试迁移到当前时,出现以下错误:
Error report -
ORA-29877: failed in the execution of the ODCIINDEXUPDATE routine
ORA-13365: layer SRID does not match geometry SRID
ORA-06512: at "MDSYS.SDO_MIGRATE", line 423
ORA-06512: at "MDSYS.SDO_MIGRATE", line 474
ORA-06512: at line 1
29877. 00000 - "failed in the execution of the ODCIINDEXUPDATE routine"
*Cause: Failed to successfully execute the ODCIIndexUpdate routine.
*Action: Check to see if the routine has been coded correctly.
这让我相信仅仅更新 SRID 是行不通的,我必须更新整个元数据。我试过这段代码:
UPDATE USER_SDO_GEOM_METADATA
SET DIMINFO = MDSYS.SDO_DIM_ARRAY
( MDSYS.SDO_DIM_ELEMENT('X', -180, 180, 0.5),
MDSYS.SDO_DIM_ELEMENT('Y', -90, 90, 0.5)
),
SRID = 8307
WHERE COLUMN_NAME = 'OTTAWAPROVRDS';
但结果是0 rows updated