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: Slow Update!!

Re: Slow Update!!

From: hitman <dsagner_at_post.t-com.hr>
Date: 6 Jul 2006 05:05:14 -0700
Message-ID: <1152187514.079234.48370@a14g2000cwb.googlegroups.com>


jsfromynr wrote:
> Basically what I am doing is
> What I want is that first six rows form group One
> and Second group is of next three rows and so on.

Please don't use rowid. It's very wrong. Since the order in an oracle table is unpredictable, you must have a column which will guarantee that your Name and City will be in the order you want. You can use a sequence for that.

So you should have something like:

Id, Name, City, Group_Id
== ===== ==== =======

1   J          LA
2   J          LA
3   J          LA
4   J          LA
5   J          LA
6   J          LA
7   J          LA1
8   J          LA1
9   J          LA1

Then you can derive Group_Id from a query like

select id, name, city, first_value(id) over (partition by name, city order by id) grp_id
from tablex

Id, Name, City, grp_id
== ===== ==== =======

1   J          LA      1
2   J          LA      1
3   J          LA      1
4   J          LA      1
5   J          LA      1
6   J          LA      1
7   J          LA1    7
8   J          LA1    7
9   J          LA1    7

...and do the update accordingly.

DS Received on Thu Jul 06 2006 - 07:05:14 CDT

Original text of this message

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