[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Create For Loop in PL/SQL

Asked by JoeSand2005 in Oracle Database

Tags: loop, select

Hi Guys,

I will highly appreciate your help in advance!
I'm new using PL/SQL codes, but I really need to get this done in PL/SQL, because of the massive data I'm working with. I need to get the Top 100 percentage of Sales, and I'd like to know if I could declare a variable in PL/SQL so I can run different queries using the For Loop. I was using Access to get the Top 100 percent of Sales and I was able to declare a variable to be use in the For loop. Lets say I want to run the TOP 1 Percent from TabelName, then Top 2 Percent from the same table, then Top 3 Percent from the same table and so on...
Here is the VBA code I'm using;

Dim X as integer


For X = 1 To 100
           
            DoCmd.RunSQL "DELETE Table1.* FROM Table1;"
            DoCmd.RunSQL "INSERT INTO Table1 SELECT TOP " & X & " PERCENT *" & _
            "FROM CustSales;"
            INSERT INTO Table2 ( CustNo, Sales )
SELECT Count(Table1.CustNo) AS Tot_Members, Sum(Table1.SALES) AS TotalSales
FROM Table1;

Next X

Basically I clean Table1 then I insert the Top 1 Percent Customers and sales from Table CustSales then I get the summary from CustSales table and inserted into Table2 to add up all my results from Table1 (1 to 100 percent). CustSales table holds about 2,500,000 records; this is the reason why I need to get this done in PL/SQL.

Thanks so much for your help!
[+][-]03/01/06 04:46 PM, ID: 16080946Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/02/06 12:21 PM, ID: 16088382Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/02/06 02:26 PM, ID: 16089939Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/03/06 10:12 AM, ID: 16096818Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/05/06 02:37 PM, ID: 16109809Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Oracle Database
Tags: loop, select
Sign Up Now!
Solution Provided By: ishando
Participating Experts: 1
Solution Grade: A
 
[+][-]03/06/06 06:51 AM, ID: 16114692Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy