Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Help, Pick highest Spend

Kodiak_SeattleJan 12 2010 — edited Jan 14 2010
Oralce 10G.

I have a Table with many unique records, kinda looks like this:

customer_key | BB | CL | LA
123 100 300 50
456 65 125 658
789 12 5 98

I need to take the highest spend.

customer_key | SPEND
123 300
456 658
789 98

Not sure how do this since, the field have different names ?
This post has been answered by Frank Kulash on Jan 12 2010
Jump to Answer

Comments

Aman....
does existing user and new connection affect when we rebuild a index?

What kind of efect you are mentioning?
Aman....
Anand...
Hii..

let me try to answer your query, it might not be 100% correct.
When you rebuild the index using ONLINE clause then, the copy of the index is maintained which is modified and then replaces the old index and by the time the new one is rebuilt the older one is used by the users.Whereas, when you simply do , alter index indexname rebuild; the index goes into unusable state and will not be available to the users.If the index which is going to be rebuilt is already being used by someone then you will get ORA error sayin RESOURCE BUSY WAIT...

Anand
26741
1. A REBUILD locks the table (the table can still be queried). A REBUILD ONLINE allows operations to run concurrently against the table.

2. You run the risk of ORA-01410 errors. For a good explanation see http://jonathanlewis.wordpress.com/2007/09/16/index-rebuild/

3. In 10g and above a REBUILD implicitly updates statistics on the Index. This can change execution plans as Oracle parses SQL statements that execute after the REBUILD.

But, generically, existing user connections and user queries are NOT affected by a rebuild.


Hemant K Chitale
http://hemantoracledba.blogspot.com
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 11 2010
Added on Jan 12 2010
6 comments
1,213 views