我有更新查询,如
update dedupctntest a set a.city = case when exists(
select b.shortname from DEDUPADDRESSDICT where lower(a.city) =lower(b.shortname) and rownum = 1) b then
b.fullname else a.city end;
Run Code Online (Sandbox Code Playgroud)
但它会给出missing keyword错误
任何人都能说出错在哪里?
您不能在其范围之外引用b.fullname,该范围位于exists()子句中.
也许这可以满足您的需求:
update dedupctntest a
set a.city = coalesce
( ( select b.fullname
from DEDUPADDRESSDICT
where lower(a.city) = lower(b.shortname)
and rownum = 1
)
, a.city
);
Run Code Online (Sandbox Code Playgroud)
即如果来自DEDUPADDRESSDICT的查询返回一个非null的全名,则使用它,否则使用a.city.请注意,如果DEDUPADDRESSDICT中有一行使用null全名,则将使用a.city.
| 归档时间: |
|
| 查看次数: |
2898 次 |
| 最近记录: |