明らかに、できません (簡略化)
set t1.fieldA = (t2.fieldB, distance) --> you want to put two values into a single column
したがって、fieldB
を取得します。 分析関数を使用するサブクエリから単独で (row_number
) sdo_nn_distance(1) desc
で行を「並べ替える」;次に、最初の行の fieldB
を取得します
このようなもの (括弧を正しく設定できれば幸いです):
UPDATE table1 t1
SET t1.fieldA =
(SELECT x.fieldB --> only fieldB
FROM (SELECT T2.fieldB, --> from your subquery
SDO_NN_DISTANCE (1) distance,
ROW_NUMBER ()
OVER (ORDER BY sdo_nn_distance (1) DESC) rn
FROM table1 T1, table2 T2
WHERE (sdo_nn (t1.geometry,
t2.geometry,
'SDO_NUM_RES=1',
1) = 'TRUE')) x
WHERE rn = 1) --> where RN = 1
WHERE EXISTS
(SELECT 1
FROM table2 t2
WHERE sdo_nn (t1.geometry,
t2.geometry,
'SDO_NUM_RES=1',
1) = 'TRUE'
AND ( t2.cell_name = 'string1'
OR t2.cell_name = 'string2')
AND t1.fieldA IS NULL);