Update with correlated subquery
407706Feb 5 2004 — edited Feb 7 2004Hi,
I have the following SQL update statement:
update temp_input_sms b
set (b.provider_id,b.region_id)=
(select provider_id,region_id
from
(
select a.PROVIDER_ID,a.REGION_ID,row_number() over (order by fraud) rn
from icdm.smsc_lookup a
where sysdate>=a.VALID_FROM and sysdate<a.VALID_TO
and b.user_summarisation like a.SMSC_CODE_LIKE
) where rn=1)
The problem is that there are two nested subqueries on the right side of the set clause, and in the inner subquery the 'b.user_summarisation' column is not available.
Could anyone suggest a workaround for this problem?
Thanks.
Viktor