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

Home -> Community -> Usenet -> c.d.o.server -> Re: Update Problem

Re: Update Problem

From: Alkos <azerty_at_nospam.org>
Date: Fri, 12 Dec 2003 17:10:24 +0100
Message-ID: <brcp9h$8062@news.rd.francetelecom.fr>

"Mohammad" <mhakimjavadi_at_hotmail.com> a écrit dans le message news: cc59b627.0312120749.2e5984d4_at_posting.google.com...
> Hi
>
> I have this query to update some records in my table. It is working
> good but my problem is this query very slow. Is any way to do this job
> faster.
>
> UPDATE SWKPIFA Y
> SET Y.SWKPIFA_TRAN_CODE = 'G'
> WHERE SWKPIFA_START_TERM =
> ( SELECT MIN(X.SWKPIFA_START_TERM)
> FROM SWKPIFA X
> WHERE Y.SWKPIFA_PIDM = x.SWKPIFA_PIDM
> AND Y.SWKPIFA_MAJR_CODE = X.SWKPIFA_MAJR_CODE)
> AND SWKPIFA_END_TERM =
> ( SELECT MAX(X.SWKPIFA_END_TERM)
> FROM SWKPIFA X
> WHERE Y.SWKPIFA_PIDM = x.SWKPIFA_PIDM
> AND Y.SWKPIFA_MAJR_CODE = X.SWKPIFA_MAJR_CODE)
> /
>
> Thanks
> Hakim

Hello,
First of all, it could be a bit useful if you could tell the ng the version of Oracle,
the OS and its version.
Second, nobody but you has even an idea of the DB you are running, what kind of app it is,
how big are your tables, what are the indices and so on. Plus, you could have posted the EXPLAIN PLAN along with your query.

Without any of these infos, one can't tell you anything except the fact that running queries
with where clauses containing num_field=(select max(num_field) from blahblah)
can be very long especially when main query and its sub queries are joined together.

--
Alkos
Received on Fri Dec 12 2003 - 10:10:24 CST

Original text of this message

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