Loop is driving me crazzy!

Hi, I can't for the life of me figure out what i'm doing wrong, I'm trying to get a System exit when i enter a 0 but the loop continues, I've tried numerous combinations anyone any idea? help is appreciated
Thanks
class Directory {
     public static void main(String args []) {          
          String lastName;
          String foreName;
          String foneNo;                    
          BufferedReader br = null;
          // use the Bufferreader API for inputing data &&
          // output necessary data to a txt file
          try {
               boolean more = true;
               int count;
               File outputFile = new File("Assignment.txt");
               PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
               while(more) {
               br = new BufferedReader(new InputStreamReader(System.in));
               System.out.print("Please enter the first name: ");     
               foreName = br.readLine();
               System.out.print("Please enter the last name: ");     
               lastName = br.readLine();
               System.out.print("Please enter the pnone number: ");     
               foneNo = br.readLine();                    
               System.exit(0);
               more = false;           
               pw.close();
               br.close();
     catch(Exception e) {
          System.err.println("FileStreamsTest: " + e);
     } // main method
} // class

What part of your code do you think would cause anything special to happen when zero is inputted anywhere?
You set more to false after the while loop had already terminated. Kind of pointless.
More likely you want that inside the loop, conditionally.
You create a BufferedReader in every iteration through the loop. It would make more sense to move it outside the loop.
You could use
foreName.equals("0")to compare that string against an inputted zero.
You probably also want to check to see what happens when there's no more input. (Hint: readLine will return null.)
Please use [code][/code] tags when posting code on this forum.
Good luck on your homework.

Similar Messages

  • Nested Loop and Driving Table.

    In the documentation I read these (/B19306_01/server.102/b14211/optimops.htm#i82080).
    The optimizer uses nested loop joins when joining small number of rows, with a good driving condition between the two tables. You drive from the outer loop to the inner loop, so the order of tables in the execution plan is important.
    The outer loop is the driving row source. It produces a set of rows for driving the join condition. The row source can be a table accessed using an index scan or a full table scan. Also, the rows can be produced from any other operation. For example, the output from a nested loop join can be used as a row source for another nested loop join.>
    I need some help to understand the bold line, i.e. so the order of tables in the execution plan is important.
    There are various conflicting opinion about the driving table (some says smaller and some says larger table is good option) and unfortunately I did not understand any of those logic.
    I read these threads/blogs also.
    CBO (optimizer) nest-loop join question
    http://hoopercharles.wordpress.com/2011/03/21/nested-loops-join-the-smaller-table-is-the-driving-table-the-larger-table-is-the-driving-table/
    In practice, I have seen explain plan for select e.ename,d.dname
      2  from emp e, dept d
      3  where e.deptno=d.deptno; usages emp as driving table (I only understood part of Aman's logic that dept table access would be faster when there would be an index available over it and hence it is in the inner loop)
    Whereas, SQL> explain plan for
      2  select e.ename,d.dname
      3  from emp e, dept d
      4  where e.deptno=d.deptno
      5  and e.deptno=20; usages dept as driving table.
    I have use USE_NL_WITH_INDEX with LEADING hint to change it, but it is giving some adverse effect (sometimes with optimizer_mode ALL_ROWS it is ignoring the hint completely).
    so the order of tables in the execution plan is important. How can I determine it ? I have read Tom's effective oracle by design but there is also no solution.

    Not sure I quite understand the question.
    Both threads contain lots of useful information about the broad considerations in play and debunking any myths.
    I need some help to understand the bold line, i.e.
    "so the order of tables in the execution plan is important"I read this as meaning just what it says, i.e. read the execution plan carefully and that
    NESTED LOOP
      A
      Bis not the same as
    NESTED LOOP
      B
      AA 10053 trace would normally be quite verbose about it's considerations as to join order.

  • Never ending loop is driving me loopy!

    If I spend anymore time on this I'll end up in a straight jacket(and then I might be able to get a job with Sun !)
    O.K. - here's the plan - the first loop should execute, evaluate if the value 'max' mod each value in the array is equal to 0. If none of the values in the array fit the criteria the program should then reach the second loop and keep going until a value is found that divides into the mod value. The second loop should stop when it reaches the square root of mod.
    Simple eh? Well it should be if I hadn't produced the code. The first loop works fine on its own and either stops when it has found the required value or stops when it reaches 999. However when the code includes the second loop as seen below the first loop becomes an endless loop.
    It is too hot today for me to be wearing a straight jacket and so I offer duke dollars to those who take pity.
    public static boolean primetest(BigInteger mod){
    BigInteger max = mod;
    int sqr = (int) Math.ceil(Math.sqrt(max.doubleValue())); // See java.lang.Math class
    BigInteger s = new BigInteger(Integer.toString(sqr));
    BigInteger endofarray = new BigInteger ("999");
    BigInteger start;
    //First loop starts here
    for (start = BigInteger.ZERO; start.compareTo(endofarray) <= 0; start = start.add(BigInteger.ONE)){
    //evaluate if max mod the next value in the array = 0
    if(max.mod(allprime[start.intValue()]).equals(BigInteger.ZERO)){
    pvalue = allprime[start.intValue()];
    qvalue = max.divide(allprime[start.intValue()]);
    System.out.println("P found :"+ pvalue + "Q found" + qvalue);
    return false;
    //Start next loop if none of the numbers in the array did the trick
    for (BigInteger i = new BigInteger("7919"); i.compareTo(s) < 0; i = i.add(TWO)){
    if(primetest(i))
    if(i.mod(max).intValue()== 0){
    qvalue = i;
    pvalue = i.divide(max);
    System.out.println("P found :"+ pvalue + "Q found" + qvalue);
    return true;
    }

    i think the second loop should return something. and according to me
    it will be like,
                   //Start next loop if none of the numbers in the array did the trick
                   for (BigInteger i = new BigInteger("7919"); i.compareTo(s) < 0; i = i.add(TWO))
                        if(primetest(i))
                             if(i.mod(max).intValue()== 0)
                                  qvalue = i;
                                  pvalue = i.divide(max);
                                  System.out.println("P found :"+ pvalue + "Q found" + qvalue);
                                  return false;
    try this.

  • SIMPLE PROBLEM DRIVING ME CRAZZY!!!...please help

    Hi, ive tried searching for this problem all over the forums, but it seems most people have more complicated ones related to this:
    I have a Jtable in a JtabbedPane...
    For the JTable i have RESIZE_ALL_COLUMNS chosen...but resize my application, the JTable does not resize!!!!!!...the JTabbedPane does resize to take up the whole width of my contentpanel (the contentpanel is on VerticalFlowLayout), while the rest are on XYLayout (in JBuilder 5)...
    I JUST NEED THE JTABLE TO EXPAND EACH COLUMN to fit the pane...how do i do this...///???
    Thanks a lot in advance
    Sid

    XYLayout uses absolute position so try using another
    layout manager that properly fits components in panel.
    I suggest to use the new one from J2SE 1.4:
    SpringLayout.
    Tutorial at:
    http://java.sun.com/docs/books/tutorial/uiswing/layout/
    pring.htmlhmm...spring layout seems like alotta code 'n seems kinda new too since itz not one of the layouts listed in the jbuilder5 layouts...is there a simpler way?...maybe using one of the older layouts???
    thanks.
    Sid

  • Z68A-GD80 B3 Boot Loop and Failed BIOS LED Flashing

    I've been having "boot loop" issues with my system since it was built in June. Basically, when the system is powered on the lights/fans come on for around 3 seconds then it shuts itself off for another 3 seconds and repeats the loop infinitely. Meanwhile there are no POST code beeps and nothing shows up on screen. I also noticed today that the Dual BIOS control LED is flashing during boot loops indicating that the primary BIOS has failed.
    As this was my first build in quite a while I didn't initially worry about it too much, figuring that it was probably just a BIOS setting or improperly seated hardware issue. Shortly there after my son was born and needless to say there wasn't a whole lot of time to trouble shoot a PC for a couple of months. Fast forward four months later to today and the boot looping is driving me nuts. It seems to occur when the system has been powered down overnight and more frequently if the reset button is used. I've read a lot of stuff saying that the Gigabyte boards are prone to this issue, but can't find anyone else with the same issue on a MSI z68 board. I've check/done the following to try and trouble shoot the issue.
    1. Flash to BIOS 17.3 (twice)
    2. Installed system speaker to hear post codes. Got a whole lot of nothing.
    3. Installed one stick of RAM in slot one. Tried all four sticks. Nothing works.
    4. Set BIOS values to default.
    5. Tried disabling and enabling XMP profiles for the RAM.
    6. Upped the voltage on the RAM to 1.5V, since the board reports an under-volt around 1.48 on auto. No effect.
    7. Disabled PLL overvolt.
    8. Enabled VDroop (still not clear on what this is).
    9. Removed both video cards and used the on chip video. No effect.
    10. Unplugged all USB devices.
    11. Tried XMP enabled and disabled for the memory.
    12. Hard drive plugged in and removed makes no difference.
    13. Bare system with only one stick of RAM installed, no difference.
    11. Lots of other crap that I can't think of right now.
    Any help would be great as I'm at a loss here.
    System specs are as follows;
    Intel 2600K
    Corsair H50 Cooler
    MSI z68a-gd80 B3 with BIOS v 17.3
    PNY Geforce GTX 560 Ti (2x in SLI)
    Linksys Wireless G PCI card
    Crucial Ballistix Sport RAM (4x2GB at 1600 MHz XMP enabled)
    Segate Barracuda 7200 RPM Drive 500GB (2x in RAID0)
    OCZ Vertex2 64 GB SSD as system cache
    Corsair TX750 Power Supply
    Corsair 600t case

    More wierd stuff.
    I couldn't get the board to boot without looping last night, tried the usual unplugging and clearing the CMOS nothing. Boot loops at every turn.
    I wonder if maybe I've got some bad pins or a poor connection on my RAM slots. I removed the RAM and began testing one by one. First stick gave a boot loop. Second stick worked. On restart the BIOS LED wasn't flashing anymore, which is odd since I hadn't yet set the BIOS fix feature to enabled. I powered down again and put my RAM back in, set my BIOS settings as suggested, and then clocked the RAM to 1333MHz. Seemed stable last night through a number of restarts.
    As for the backup BIOS reporting v 17.3. Yeah, that is odd. The manual says it can't be flashed either. Maybe BIOS just reports what the primary version number is no matter which chip (primary or secondary) is actually active and being booted from?
    I'd like to think this is over, but I'm sure when I go home and power up I'll get another boot loop. I'd rather not be without a PC for a couple weeks, but I may just have to RMA so I don't have to deal with this anymore. It's quite frustrating to have fiddle around for 10+ minutes to get your PC up and running, plus with a RAID0 setup and SSD cache I'm just asking for a system failure with all these power on/off cycles.

  • CBO (optimizer) nest-loop join question

    OS: Red Hat Linux
    DB: 11gR1
    I have gotten two conflicting answers while reading books by Don Burleson and Dan Hotka. It has to do with the CBO and nested-joins:
    One says the CBO will choose the 'smaller' table as the driving table, the other states that the 'larger' table will be the driving table. And both stick by this philosophy as the preferred goal of any SQL Tuning -- that is, one states that the 'smaller' table should be the driving table. The other says the 'larger' table should be the driving table.
    I had always thought that the 'smaller' table should be the driving table. That in a nested loop the driving will not likely use an index even. Who is correct? (I am not going to say who said what, btw). :-)
    But I got to let one of them know they got a 'typo' ... :-)
    Thx.

    user601798 wrote:
    It is an over-simplistic scenario but, as I mentioned, if all other things are 'equal' -- which would include 'access time/work', then I think the small table as the driving table has the advantage.
    It is not possible for +"*all* other things to be equal"+. (my emphasis).
    If by +'access time/work'+ you mean the total is the same then it doesn't matter which table is first, the time/work is the same either way round.
    If you want to say that the +'access time/work'+ for acquiring the first rowsource is the same for both paths, and the +'access time/work'+ for acquiring related rows from the second table is the same FOR EACH DRIVING ROW, then the total +'access time/work'+ will be difference, and it would be better to start with the smaller table. (The example by Salman Qureshi above: Re: CBO (optimizer) nest-loop join question would apply.)
    On the other hand, and ignoring any idea of "all other things being equal", smaller tables tend to have smaller indexes, so if your smaller rowsource comes from a smaller table then acquiring those rows may be cheaper than acquiring rows from a larger table - which leads to the observation that (even with perfectly precise indexing):
    <ul>
    smaller number of rows * larger unit cost to find related rows
    </ul>
    may produce a larger value than
    <ul>
    larger number of rows * smaller unit cost to find related rows
    </ul>
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    A general reminder about "Forum Etiquette / Reward Points": http://forums.oracle.com/forums/ann.jspa?annID=718
    If you never mark your questions as answered people will eventually decide that it's not worth trying to answer you because they will never know whether or not their answer has been of any use, or whether you even bothered to read it.
    It is also important to mark answers that you thought helpful - again it lets other people know that you appreciate their help, but it also acts as a pointer for other people when they are researching the same question, moreover it means that when you mark a bad or wrong answer as helpful someone may be prompted to tell you (and the rest of the forum) what's so bad or wrong about the answer you found helpful.

  • Screen dimming issue (?)

    Hi, sometimes, (usually when web surfing) my screen dims on its own, at first I thought there was a problem with the screen, but then I realized that the brightness meter does go down, and raises again if I press the brightness button, BUT when its going down, the brightness does NOT display on screen, it just goes down... Also, it is like crazy drastic, it just dims enough to **** me off, like a few notches, very annoying, its been driving me crazzy since I bought it just never thought to ask anyone for help... Any ideas how to fix this?

    Go to System Preferences Hardware Displays and uncheck the box for "Automatically adjust brightness as ambient light changes".
    Then go to the Energy Saver and uncheck "Slightly dim the display when using this power source" for the Power Adapter and the Battery selections.

  • Loop driving me loopy

    New at EA and I've watched several tutorials on this subject:
    I have an animation set to auto play with several nested symbols all the exact same length in time. I've tried setting a "play" action at the end of the timeline but nothing happens. I've also tried setting the "play" trigger on the symbols themselves but nothing happens. I'm going crazy.

    You need a sym.play(0) trigger at the end of each of the five slideshow timelines, if indeed you want them to loop simultaneously inside your main symbol.
    Decomposing into symbols is not a question of efficiency, but of structuring your project. Everything in the Stage (in Edge Animate, the stage is itself a symbol, so your main symbol is useless) would lead to a huge stack of elements in the single timeline : much more difficult to read and maintain.
    Gil

  • Lock ups and sound looping!

    I remember reading something here about people having trouble with their systems locking up and then getting a loud static noise then a sound loop when playing games.
       I am getting this about 2-3 times a night now and it is driving me nuts, I do not have temp problems of any sort and I have all of the latest drivers for everything on my system.
      Any ideas?
    Specs in sig

    Set your PCI/AGP Freq to 66.66/33.33MHz.
    Increase your DDR Voltage to 2.7~2.8v.
    Check if you have any background programs causing all high CPU load times while gaming.

  • Need help calling and looping custom classes

    Hi, I am writing a code with custom classes in it and another program that calls upon all of the classes in the first program. I can get the second one (L6) to call upon and execute all of the classes of the first (Foreign). However, I need the second one to loop until quit is selected from the menu on Foreign and I can't seem to figure out how to do it. Here are the codes:
    L6:
    public class lab6
    public static void main(String[] args)
    Foreign camount = new Foreign();
    camount = new Foreign();
    camount.get();
    camount.print();
    camount.intake();
    camount.convert();
    camount.vertprint();
    System.out.println(camount);
    Foreign:
    import java.util.Scanner;
    public class Foreign
    private String country;
    private int choice;
    private float dollars;
    private float conversionValue;
    private float conversionAmount;
    public Foreign()
    country = "null";
    choice = 0;
    dollars = 0;
    conversionValue = 0;
    conversionAmount = 0;
    public void get()
         Scanner Keyboard = new Scanner(System.in);
              System.out.println("Foreign Exchange\n\n");
    System.out.println("1 = U.S. to Canada");
    System.out.println("2 = U.S. to Mexico");
    System.out.println("3 = U.S. to Japan");
    System.out.println("4 = U.S. to Euro");
    System.out.println("0 = Quit");
    System.out.print("\nEnter your choice: ");
    choice = Keyboard.nextInt();
    public void print()
    System.out.print("\nYou chose " + choice);
    public void intake()
         Scanner Keyboard = new Scanner(System.in);
              if (choice >= 1 && choice <= 4)
    switch (choice)
              case 1: System.out.println("\nU.S. to Canada");
                        conversionValue = 1.1225f;
                        country = ("Canadian Dollars");
                        break;
              case 2: System.out.println("\nU.S. to Mexico");
                        conversionValue = 10.9685f;
                        country = ("Mexican Pesos");
    break;
              case 3: System.out.println("\nU.S. to Japan");
                        conversionValue = 118.47f;
                        country = ("Japanese Yen");
    break;
              case 4: System.out.println("\nU.S. to Euro");
                        conversionValue = 0.736377f;
                        country = ("European Union Euros");
    break;
                   System.out.print("\nEnter U.S. dollar amount: ");
              dollars = Keyboard.nextFloat();
    public void convert()
    conversionAmount = conversionValue * dollars;
    public void vertprint()
    System.out.println("\nCountry = " + country);
    System.out.println("Rate = " + conversionValue);
    System.out.println("Dollars = " + dollars);
    System.out.println("Value = " + conversionAmount);
    public String toString()
    String line;
    line = "\n" + country + " " + conversionValue + " " + dollars + " " + conversionAmount;
    return line;
    I appreciate any help anyone can give me. This is driving me crazy. Thanks.

    1. first you need to write method to get choice value from Foreign class.
    simply add this method.
       public class Foreign {
          // ... Add this
          public int getChoice() {
             return choice;
       }2. Then in your main, you can obtain with previos method.
    public static void main(String[] args) {
       Foreign camount = new Foreign();
       // remove this. you alredy create an instance in last statement.
       //camount = new Foreign();
       int choice = 0;
       do {
          camount.get();
          choice = camount.getChoice();
          // your process...
       } while (choice != 0);
    }

  • Loops in arrange - regionsnot functioning

    This issue have been following me since Logic 6 to 7 on my dual G4...and after a big studio-upgrade now also on 8.0.2 and a mac pro.
    For some reason In some arangement, not all, (and this can easily be in very light arrangement with not much pressure on anything) If I make a loop in arrange, then certain instruments simply wont play the first notes on the first round. It could e.g be a piano region, which plays the first chord on count 1 smothly. then on count 3 and 4 theres some single notes which wont be played untill half bar later and then like a hikup with both notes at once. Second time the loop runs through it runs smothly....but its very annoying when u want to edit and listen from the start of the bar.
    This happens even if I change the instrument. It could be Logic instruments or 3.part. AND ITS driving me nuts for sure. Really hope theres a solution for this..??
    Best regards
    Bjørn

    i have a similar problem right now.
    1. on play back, i wont hear the first note.
    2. on play back, although i played multiple keys, logic will only play back one of the keys i played.
    let me know if you solved this problem

  • Loops in Context

    Hi All,
    I'm just starting to use Business Objects Designer recently and I have a question about loops.
    Consider the following situation:
    ------------      a    --------------    c
    | Case     | ----------| Category | -----------\    -------------
    ------------           --------------           ----|Durability |
          |           b     -------------    d      ----|           |
          | ---------------| Status     |----------/     ------------
    Cardinality from left to rigth:
    Join A : N - 1
    Join B : N - 1
    Join C : 1 - N
    Join D : 1 - N
    So, a Case has a Status and a category. Depending on  the category the status has a durability.
    I designed my universe as above and when i create a Web Intelligence Document in InfoView it picks both join C an D which is intended. However the Integrity Check comes up with this as being a loop.
    Can I keep my design like this, even though it would be marked as unresolved loop or should I try another aproach (derived table probably?)
    I hope my question is clear enough, Please Advice,
    TIA

    You don't want loops!
    Seriously, that means that you will always get ALL joins in the query if you need just one...
    So in this case only combinations that are both in the left and and in the right hand table.
    There are only very limited situations in OLTP schema's when you want that and even then it is better to hide the loop using derived tables.
    My personal approach in any schema after you solved these difficulties in OLTP schema's
    1) Look for functionally different uses of tables. Like address that is joined to customer three times because they have more than one addres. Or calendar that is joined to different dates. For these cases use aliases.
    Another pointer can be that the users want two different objects for the same table.column.
    2) Doublecheck your cardinalities, not by using the check, but by making testqueries or just using your brains.
    A product can be sold more than once so product to sales is 1:N, duh...
    3) Hit the detect context button and let BO generate the contexts for you.
    Rename if you want (but its easier to work with an alias on the context driving table that has the name of the context ;).
    Done!
    Hope this helps,
    Marianne

  • How to use while loops to implement a simple climate control.

    Hi,
    I am currently a 4’th year computer systems engineering student in South Africa doing a primitive climate control project in LabVIEW 8.0. Although my knowledge and skill level of LabVIEW is far from that of an expert, I really enjoy working with it. The project consists of a motor driving some fan blades, a resistor heater and an analog temperature sensor. The basic functionality entails that a user specifies a desired temperature and then the program will heat if the current temperature is lower than desired or cool if the current temperature is above the desired temperature.
    What I want to add is an acceptable temperature difference so that the fan and heater do not switch constantly as the threshold temperature is reached. Rather leave the current temperature to linger between the maximum (current + acceptable difference) or minimum (current – acceptable difference) allowed temperature before heating or cooling it to the desired temperature once again.
    I have attached 2 VI’s:
    Final Assignment: I tried to achieve the sensible climate control by making use of a formula node. As soon as I substituted the if statements in the formula node with while statements, the VI did not respond. It did not give any errors, it just didn’t respond.
    Final Assignment2: I tried the same but by making use of while loop structures. The while where my Input DAQ is works fine, but none of the other while loops work.
    Please advise me on possible solutions for my problem/project.
    Thank you in advance.
    D. Weppenaar
    Attachments:
    Final Assignment1.vi ‏254 KB
    Final Assignment21.vi ‏256 KB

    1. Your VI does not respond because your formula node is trapped in an infinite loop and cannot exit if you're out of the deadband. Replace the words "while" with "if" (or similar) and you might be getting somewhere. Sorry, I don't have DAQ installed, but what determines the loop rate?
    2. You have a dataflow issue. Only the inner loop on the left will run. All other loops must wait because they depend on data from the first loop. data is only available at an output tunnel of a loop once the loop finishes and a loop cannot start until all input tunnels contain data. Also the first loop can never stop, because the stop button is outside the loop and will never get read once the inner loop starts. The stop button needs to be in the innermost loop.
    Most likely, all code segments should run synchronized, so delete all the inner loops. They serve no purpose. All yon need is the big outer loop as in the first code.
    There are many ways to directly observe what is going on. For example you could run the VI in execution highlighting mode while watching the diagram.
    Clearly, you need to become more familiar with LabVIEW basics. Maybe do a tutorial? Right now you might think that dataflow is a hindrance while in fact it is one of the most powerful advantages of dataflow programming. You simply need to be familiar with its logic.
    LabVIEW Champion . Do more with less code and in less time .

  • Nested loops and if statements

    I have four schemas with a problem category table "gppcat" that
    has problem categories and problem descriptions. I need to
    output these categories and descriptions to a csv file. while
    doing this I need to make sure I don't include duplicate
    records. I use schema 1 as a system of record. I want to select
    pcode "category" from schema 1 and loop through to compare each
    record in the other schemas and write each unique record once to
    the file. I have included the code I am writing. I son't have
    much experience in PL/SQL, I usually write in ABAP or Java so
    the looping and if logic may seem incongruent as I have never
    implemented this in PL/SQL before. Thanks in advance, all the
    answers I have gotten fomr this forum have been great.
    CURSOR C1
    IS
    SELECT PCODE, PDESC FROM gpcomp1.gppcat;
    CURSOR C2
    IS
    SELECT PCODE, PDESC FROM gpcomp2.gppcat;
    CURSOR C3
    IS
    SELECT PCODE, PDESC FROM gpcomp3.gppcat;
    CURSOR C4
    IS
    SELECT PCODE, PDESC FROM gpcomp4.gppcat;
    -- error handling routine. we will handle all file access errors
    -- and data access errors in this procedure err_processing
    PROCEDURE err_processing (p_errFileHandle UTL_FILE.FILE_TYPE,
    p_lineNum PLS_INTEGER,
    p_errText VARCHAR2)
    IS
    BEGIN
    lv_errorFile := UTL_FILE.FOPEN(p_errDir,p_errFile,'W');
    UTL_FILE.PUT_LINE( lv_errorFile, lv_initErrorLog );
    UTL_FILE.FFLUSH(lv_errorFile);
    UTL_FILE.FCLOSE(lv_errorFile);
    UTL_FILE.FCLOSE_ALL;
    END err_processing;
    -- Retreive data into cursors
    BEGIN
    catFileHandle := UTL_FILE.FOPEN(p_dirName,p_fileName,'W');
    Here we need to loop through 4 companies and write all Problem
    Codes (pcode) and
    Problem Descriptions (pdesc) without writing duplicates. In this
    case we are using
    the same logic in the old extract by using the US company as the
    driving table.
    We compare the pcode, record by record in eanch 4 companies.
    When we find a unique
    record we write it to the file.
    FOR catLine1 IN C1
    LOOP
         FOR catLine2 IN C2
         LOOP
         IF catLine2.pcode = catLine1.pcode THEN
         writeLine:= (catLine1.pcode) || ',' ||
    (catLine1.pdesc);
              UTL_FILE.PUT_LINE( catFileHandle, writeLine );
         ELSE
         writeLine:= (catLine2.pcode) || ',' ||
    (catLine2.pdesc);
              UTL_FILE.PUT_LINE( catFileHandle, writeLine );
         END IF;
         END LOOP;
         FOR catLine3 IN C3
         LOOP
         IF catline3.pcode = catLine1.pcode THEN
         writeLine:= (catLine1.pcode) || ',' ||
    (catLine1.pdesc);
              UTL_FILE.PUT_LINE( catFileHandle, writeLine );
         ELSE
         writeLine:= (catLine3.pcode) || ',' ||
    (catLine3.pdesc);
              UTL_FILE.PUT_LINE( catFileHandle, writeLine );
         END IF;
         END LOOP;
         FOR catLine4 IN C4
         LOOP
         IF catline4.pcode = catLine1.pcode THEN
         writeLine:= (catLine1.pcode) || ',' ||
    (catLine1.pdesc);
              UTL_FILE.PUT_LINE( catFileHandle, writeLine );
         ELSE
         writeLine:= (catLine4.pcode) || ',' ||
    (catLine4.pdesc);
              UTL_FILE.PUT_LINE( catFileHandle, writeLine );
         END IF;
         END LOOP;
         EXIT WHEN C1%NOTFOUND;
         UTL_FILE.PUT_LINE( catFileHandle, writeLine );
    END LOOP;
    UTL_FILE.FFLUSH(catFileHandle);
    UTL_FILE.FCLOSE(catFileHandle);
    Thanks again.
    -Pat

    The easiest way of doing this is to use the UNION operator.
    You just have one cursor, viz:
    CURSOR C1
    IS
    SELECT PCODE, PDESC FROM gpcomp1.gppcat
    UNION
    SELECT PCODE, PDESC FROM gpcomp2.gppcat
    UNION
    SELECT PCODE, PDESC FROM gpcomp3.gppcat
    UNION
    SELECT PCODE, PDESC FROM gpcomp4.gppcat;
    This will return only unique rows (to get duplicates you use
    UNION ALL). Then you can use a single CURSOR LOOP structure to
    write out the result set:
    FOR lrec IN C! loop
    utl_file.put_line(C1.pcode);
    END LOOP;
    HTH, APC

  • Read this if you have the Looping Audio issue...

    I was having this problem and it was driving me nuts. It would do it randomly everytime I used iTunes. I searched around the web but could not find anything related to this issue except for these forums.
    What fixed it for me -
    Go into your Sound preferences and look at the Output tab. Is the balance centered? Mine wasn't. It was moved a few notches to the left. This problem has been occuring for quite awhile where the balance will move by itself! I moved it to the center and have NOT had a single problem with the looping audio anymore.
    Try it! Let me know if it works! =)

    I had same problem not with XP but with Windows 7 beta. I posted online and a lot of people said Realtek this and Realtek that, it didn't work for me. I finally tried installing Bootcamp 2.1 and voila it worked. While it was installing drivers, I noticed bootcamp saying "Removing Realtek audio ... " then "Installing SigmaTel audio ... " few seconds later i started hearing all the bells and whistles of Windows 7. Woohoo!
    I guess Realtek works for some people with various configurations but for me it was Siggy.

Maybe you are looking for

  • Thinkpad Power manager causing problems in Vista

    Hi, We have been having problems with the Thinkpad power manager (all versions that we've tried) on Vista with T400, T500, and T60 series laptops.  These problems range from the program crashing to blue screens and reboots.  If we remove the software

  • What's the deal with Drop-Frame / Non-Drop-Frame Timecode?

    I'm having trouble with 30fps Drop-Frame and 30fps Non-Drop-Frame timecode formats! I thought 29.97fps means 30fps Drop-Frame, but now I'm all confused. I'm working with DSLR footage filmed with a frame rate of 29.97. For example, this one clip is li

  • Download java output to word doc

    Hi , I would like to download the java output iview into Word document. IS it possible ? Thanks and regards, Sithi

  • Can't preview webpage in firefox

    Hello, i've been using firefox to preview my webpages in dreamweaver for some time now and for some reason it won't open the page in firefox. If i use explorer or safari it works fine. Any suggestions as to why it might not be loading? thanks

  • Filter datagrid using search

    hye...can anyone help me... how to filter a datagrid using search function? i have been doing some search,but nothing work...can someone show me??here,i attach my codes any help would be really appreciated thanks in advance.