Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sorting from several cursors

Status
Not open for further replies.

diggy8

IS-IT--Management
May 24, 2002
35
US
I'm new to Oracle, having a SQL Server background.

The situation here is that I have three cursors, one brings the client details (name, city, etc), another gets the client sale count, the other gets the client repair count. I broke it into three cursors, from one, because as a single query, it was taking 8 seconds to run. Now with three cursors, I want to combine all the details and sort by the sale and repair counts. Then I need to manipulate that data a little and output it.

What sort of structure do I put the cursor data into that will let me sort?

Thank you
 
You would need PL/SQL to process the results from each individual cursor, but why would you want to do that?

Instead, you should investigate why the query takes 8 seconds. Have you got correct indexes set up etc.? Has the query been constructed correctly?
 
Thanks lewisp

I'm web developer, not a DBA and it was a DBA that suggested I break it up, so I did as told :) I might be possible an index isn't set up properly. In our dev and test environments, the package comes back in at most 1 second, but production it's taking forever to come back. Production does have much more data, so I was thinking that was the problem.

I suppose I'll run on the idea that the indexes aren't in place. Breaking this in to 3 cursors only made the code much more difficult to read, in my opinion.
 
You need to run explain plan on your single-cursor solution then run the output past your DBA. He should know what I am talking about! [wink]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top