PL/SQL : Probleme with not existence of result in temporary table

From: Philippe Gobin <philippe.gobin4_at_netcourrier.com>
Date: 7 Mar 2003 15:33:22 -0800
Message-ID: <6104c869.0303071533.4f314deb_at_posting.google.com>


PL/SQL : Probleme with not existence of result in temporary table

Hi, i have a problem with this request :

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
		)
where
	TABLE_1.val = TABLE_U.val
	AND TABLE_2.cd_mkp = TABLE_U.cd_mkp

;         

With this, i want this result :

When 'res' exists, the field must be update whith PV.res. When 'res' doesn't exist (the request that generate TABLE_2 give no line), the field 'fild_u' must not be changed.

In fact the resut is :
When 'res' exists, the field must be update whith PV.res. When 'res' doesn't exist, the field 'fild_u' IS UPDATED BY NULL.

Is anybody can help me ?

Thanks
PG Received on Sat Mar 08 2003 - 00:33:22 CET

Original text of this message