Re: PL/SQL : Probleme with not existence of result in temporary table
Date: 10 Mar 2003 04:51:22 -0800
Message-ID: <c0e3f26e.0303100451.695b90e9_at_posting.google.com>
You must supply a WHERE clause for TABLE_U that means that only those records that have a matching "res" value get updated.
You can do this by adding "where exists (select ...)" or "where
(column list) in (select ...)", whichever seems more appropriate.
I have added the "where exists" version to your query as it is easier
(I just cut and pasted the select, you might want to improve on that).
I also removed some invalid WHERE conditions.
update
TABLE_U
set field_u = (
select PV.res
from
TABLE_1
,
(
SELECT CI4.cd_mkp, SUM(CI4.mt_pvp) res FROM INTRA_IFT_CAT CI4 WHERE CI4.ind_netting = 0 GROUP BY CI4.cd_mkp, ) TABLE_2
where
TABLE_1.val = TABLE_U.val
AND TABLE_2.cd_mkp = TABLE_U.cd_mkp
) pv
where
exists (
select PV.res
from
TABLE_1
,
(
SELECT CI4.cd_mkp, SUM(CI4.mt_pvp) res FROM INTRA_IFT_CAT CI4 WHERE CI4.ind_netting = 0 GROUP BY CI4.cd_mkp, ) TABLE_2
where
TABLE_1.val = TABLE_U.val
AND TABLE_2.cd_mkp = TABLE_U.cd_mkp
)
;
Received on Mon Mar 10 2003 - 13:51:22 CET