Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Update

Re: Update

From: Alexander Fatkulin <afatkulin_at_gmail.com>
Date: Tue, 13 Mar 2007 10:52:07 +1000
Message-ID: <49d668000703121752l8cb1915y9b52958faf94657d@mail.gmail.com>


Ranko,

since you are almost certainly going ahead to ORA-01779 with such kind of query if you write it as a single "update (select ...) set ..." (Oracle doesn't like when you join tables with supplied variables/literals even if that leads to a fully key-preserved join).

I would try to use merge instead. Something like this (I've just typed it in, can't verify):

merge into sub_svc_parm ssp

	using (
		SELECT b.sub_svc_id, d.destination_group_id val
			FROM sub_svc a, sub_svc b, sub_svc_parm c, RATE_CENTRE_TEMP_&1 d
			WHERE a.SUB_ID = b.SUB_ID
				AND a.SVC_ID = 10000
				AND b.SVC_ID = 10008
				AND a.SUB_SVC_ID = c.SUB_SVC_ID
				AND c.parm_id = 10230
				AND SUBSTR(c.val,1,6) = d.npanxx) v
	on (ssp.sub_svc_id=v.sub_svc_id and ssp.parm_id = 12650)
	when matched then update set ssp.val=v.val;

btw - what version? I assume you're on 10g so you don't need both matched/not matched sections.

On 3/13/07, Ranko Mosic <ranko.mosic_at_gmail.com> wrote:
> Hi List,
> I need to update large table sub_svc_parm ( over billion rows). This
> is PL/SQL block that does it:
> I want to rewrite so it is executed as single SQL update statement.
> Any suggestions ?

-- 
Alexander Fatkulin
--
http://www.freelists.org/webpage/oracle-l
Received on Mon Mar 12 2007 - 19:52:07 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US