我想从下面的查询中将两列UG_length
和AR_length
分别更新为NE_length
的80%和20%。
SELECT
CALCULATED_LENGTH AS NE_LENGTH ,
(CASE WHEN RJ_CONSTRUCTION_METHODOLOGY NOT LIKE '%AERIAL%' OR RJ_CONSTRUCTION_METHODOLOGY IS NULL THEN NVL(CALCULATED_LENGTH,0)
ELSE 0 END) AS UG_length,
(CASE WHEN RJ_CONSTRUCTION_METHODOLOGY LIKE '%AERIAL%' OR RJ_CONSTRUCTION_METHODOLOGY IS NULL THEN NVL(CALCULATED_LENGTH,0)
ELSE 0 END) AS AR_length
FROM NE.MV_SPAN@DB_LINK_NE_VIEWER;
请帮助在oracle中最简单的方法
我需要NE_length列的按比例分叉
答案 0 :(得分:1)
您可以使用更新
update NE.MV_SPAN@DB_LINK_NE_VIEWER
set UG_length = (CASE WHEN RJ_CONSTRUCTION_METHODOLOGY NOT LIKE '%AERIAL%' OR RJ_CONSTRUCTION_METHODOLOGY IS NULL THEN NVL(CALCULATED_LENGTH,0)*0.8
ELSE 0 END)
, AR_length = (CASE WHEN RJ_CONSTRUCTION_METHODOLOGY NOT LIKE '%AERIAL%' OR RJ_CONSTRUCTION_METHODOLOGY IS NULL THEN NVL(CALCULATED_LENGTH,0)*0.2
ELSE 0 END)