2015-05-20 27 views
0

我有一個單一的幾何字段更改單個條例的值甲骨文 - 在表中在幾何形狀區域

select g3e_GEOMETRY from MyTable 
where g3e_FID = 15463352 

這返回

(3001,(,,),(1, 1,1,4,1,0,...,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,...,...,...,...,...,...,..., ,...,(1920181.3264,5801197.1585,0,0.345448182564728,0.93843782594412,0,...,,,,,,,,,,,,,,,,,,,, ,...,...,...,...,...,...,..., ,,,,,,,,,,,,,,,,))

技術上一樣

SELECT SDO_GEOMETRY(3001,NULL,NULL, 
    SDO_ELEM_INFO_ARRAY(1,1,1,4,1,0), 
    SDO_ORDINATE_ARRAY(1920181.3264, 5801197.1585, 0, 0.345448182564728, 0.93843782594412, 0)) AS g3e_GEOMETRY 
FROM dual; 

現在我想改變0.93843782594412值說1.5

我可以從sdo_ordinances功能

select g.* from table(select p.g3e_GEOMETRY.sdo_ordinates from MyTable p 
where g3e_FID = 15463352) g; 

這會返回一個表叫做COLUMN_VALUE

一列得到各個位
1920181.3264 
5801197.1585 
0 
0.345448182564728 
0.93843782594412 
0 

但我現在不知道創建更新語句,這樣我就可以更新0.938437825944121.5所需的SQL。

從我一直在閱讀你必須一次更新整個sdo_ordinate數組。所以真的我需要生成下面的行(舊值+我的替換值)

SDO_ORDINATE_ARRAY(1920181.3264, 5801197.1585, 0, 0.345448182564728, 1.5, 0) 

任何想法讚賞。

Chris

+0

你試過'REPLACE'功能嗎? – RubahMalam

回答

1

您可能需要一些PL/SQL代碼。

declare 
    l_geometry mdsys.sdo_geometry; 
begin 
    -- Get the geometry from the table into the variable. 
    select g3e_geometry 
    into l_geometry 
    from mytable 
    where g3e_fid = 15463352; 

    -- Now you can do whatever you want with it. 
    l_geometry.sdo_ordinates(5) := 1.5; 

    -- Write back to the table 
    update mytable 
     set g3e_geometry = l_geometry 
    where g3e_fid = 15463352; 
end; 

由於您的建議更新似乎有點隨機,這就是我現在所能做的。

+0

謝謝 - 這正是我需要的。 –