While loop in a for loop,Is it possible?

Is It possible to call a while loop a particular number of time's using a for loop.
for example :
for(.....){
while(true)
Is this technically possible?
Thanks,

Hans9777 wrote:
Based on the code you wrote , the program will enter the for loop and then the while loop . It will never exit the while loop as while(true) means loop infinite times. normally while do-while and for loop can be immplemted for the same function therefore they are rarely used together.Obviously his code only showed the loop structures themselves with no loop bodies. Supposedly there may be a 'break' in the while loop somewhere, so it is not necessarily an infinite loop.
And your remark about them rarely being used together is nonsense. Loops within loops are written for legitimate logic purposes all the time, regardless of what kind of loops they are.

Similar Messages

  • Using while loops instead of for loops in arrays?

    I am new to java and doing a java tutorial on using arrays and for loops. What im trying to find out is how it is possible to use a while loop instead.
    I would be very grateful if anyone can suggest a way of changing my code to use a while loop.
    The code I have written is:
    public class DetermineGrade
    public static void main(String[]args)
    final char[] mark = {'A','B' ,'C' ,'D' ,'F' };
    char [] grade = new char[5];
    int [] Score ={95,35,65,75};
    for (int i=0; i<4; i++)
    if (Score >= 90)
    grade= mark[0] ;
    else if (Score >=80)
    grade = mark[1] ;
    else if (Score >=70)
    grade = mark[2] ;
    else if (Score >=60)
    grade = mark[3];
    else grade = mark[4];
    for (int i=0; i<4; i++)
    System.out.println("grade = " + Score + ", " + grade);
    Thankyou LB

    Im trying to underdstand the differences in the
    different loops. I can grasp the for loop but I dont
    see how a while loop works, or how it id different
    from the other?
    for (j = INIT; j < MAX; j++) {
        // do stuff
    }is the same as
    j = INIT;
    while (j < MAX) {
        // do stuff
        j++;
    }Lee

  • How to pass the sequence number of current loop in a for loop in FPGA vi to the host

    PCI-7830R
    LV 8.2
    What I was trying to do is to use multiple DIO to generate pulse at different sequence. Mode one is to automatically sweep from DIO1 to DIO20; mode 2 is several DIOs generate pulse simoutaneously.  So I use a case structure to make the selection, in the mean time, I set up two for loop in each case so that I can use multiple pulse generations. For example, in scanning mode, if I set 2 exposures, it sweeps from 1 to 20 then do it again.  
    Then I need to get the loop sequence number, i of each scenario. So I put an indicator within the first loop, and create a local variable of it and put in the second one.  Running the FPGA vi alone, I can see the indicator change in each case from 0 to N-1, N being the for loop time.But in the host vi, I tried to add this indicator as an element in the read/write invoke method, in the debugging mode, I could only see it directly jump to N-1 without all the changes I saw in FPGA vi. 
    Is it possible to get this number passed correctly from FPGA vi to the host vi? Thanks

    Thanks for the reply Jared.
    Excuse me if it looks incorrect, but I'm new to FPGA programming, so I would have to look into the FIFO you referred to.  I used local variables because for one thing I have several different cases containing for loop in each of them, and I only want one indicator for the "i".  If I put the indicator out of any for loop, it's only gonna show the last number which is N-1.  For the other thing, it seems like property nodes are not allowed in FPGA vi.  And by doing this, I can see the i number changing from 0 to N-1 in each case, well, in FPGA vi's front panel.  But while I ran the host vi with everything, the indicator in host vi's front panel only showed the last number N-1. It may be the reason you said, it happened too fast before the indicator in host vi can catch it.
    What I want to realize is to group the data I collect in host vi, for example, when I choose multiple exposure in each mode, and the FPGA runs 1 through 20 then do it again, I want the data stored in two groups using the loop sequence number as the seperator in file name.  So it goes like 1-1, 2-1.......20-1; then 1-2, 2-2,.....20-2.

  • Java For-each loop to JavaFX for loop

    Hi
    I have a the following Java for-each loop :
    private int w = 250;
    private int h = 100;
    private int targetPixel[];
    private final static int a = 0xff000000;
    for (int i=w*h-1;i>=0;i--)
         targetPixel=a;
    My problem is since in JavaFX their is no for each loop how do you convert this java for-each loop to a JavaFX loop? Could you please provide me a solution with a sample code.
    Thank you.

    How to resolve this code to java fx?
    int particles = 10;
    int textures = 32;
    Random rnd =new Random();
    IDX particle=new IDX [particles];
    for(int i=0;i<particles;i++)
         particle=new IDX (textures*i/particles,rnd);
    Here new IDX is a class like the following class IDX
         double x;
         double y;
         double z;
         int xx;
         int yy;
         int index; //Texture index
         public IDX (int textureID,Random rnd)
              x=rnd.nextDouble()*2-1;
              y=rnd.nextDouble()*2-1;
              z=rnd.nextDouble()*2-1;
              index=textureID;
    my problem is how do you pass values to a java fx class constructor if javafx class has constructors. please help?
    Edited by: R34GTR on May 14, 2009 8:29 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • For Loop Inside A For Loop

    Is it possible to execute all the iterations of the inside for loop for each iteration of the outside for loop? I have attached a screenshot of my program if it helps. If it is possible could you tell me how to do it plz?
    Solved!
    Go to Solution.
    Attachments:
    Capture.PNG ‏53 KB

    One thought I have is that I think you want those feedback nodes reinitializing for each iteration of the outter loop.  Personally, I would change them to be shift registers (it would clean up your diagram a little bit).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • A 'For' loop within another 'For' loop

    This is the loop:
    for (int i = 1; i<=5; i++) {
    for (int k = 1; k<=3; k++) {
    System.out.println("i is " + i + ", k is " + k);
    How does it execute? After it goes through the loop i = 1, and k = 1, apparently it then doesn't go to i = 2, but instead it increments k to 2, and i remains as 1 until k is greater than 3. I'm confused how this works. Does the first loop execute first, and then the second loop executes, but then the program exits out of the second loop only when k is greater than 3?
    Much appreciate your help.
    Yash

    Try to imagine expanding the loops. In the example you provided, the loops aren't that big, so it's pretty easy.
    for (int i = 1; i<=5; i++) {
      for (int k = 1; k<=3; k++) {
        System.out.println("i is " + i + ", k is " + k);
    }becomes
    int i = 1;
      for (int k = 1; k<=3; k++) {
        System.out.println("i is " + i + ", k is " + k);
    i = 2;
      for (int k = 1; k <= 3; k++) {
        System.out.println("i is " + i + ", k is " + k);
    i = 3;
      for (int k = 1; k <= 3; k++) {
        System.out.println("i is " + i + ", k is " + k);
    i = 4;
      for (int k = 1; k <= 3; k++) {
        System.out.println("i is " + i + ", k is " + k);
    i = 5;
      for (int k = 1; k <= 3; k++) {
        System.out.println("i is " + i + ", k is " + k);
      }which becomes
    int i = 1;
      int k = 1;
        System.out.println("i is " + i + ", k is " + k);
      k = 2;
        System.out.println("i is " + i + ", k is " + k);
      k = 3;
        System.out.println("i is " + i + ", k is " + k);
    i = 2;
      k = 1;
        System.out.println("i is " + i + ", k is " + k);
      k = 2;
        System.out.println("i is " + i + ", k is " + k);
      k = 3;
        System.out.println("i is " + i + ", k is " + k);
    i = 3;
      k = 1;
        System.out.println("i is " + i + ", k is " + k);
      k = 2;
        System.out.println("i is " + i + ", k is " + k);
      k = 3;
        System.out.println("i is " + i + ", k is " + k);
    i = 4;
      k = 1;
        System.out.println("i is " + i + ", k is " + k);
      k = 2;
        System.out.println("i is " + i + ", k is " + k);
      k = 3;
        System.out.println("i is " + i + ", k is " + k);
    i = 5;
      k = 1;
        System.out.println("i is " + i + ", k is " + k);
      k = 2;
        System.out.println("i is " + i + ", k is " + k);
      k = 3;
        System.out.println("i is " + i + ", k is " + k);

  • While loop and for loop condition terminal

    Hello friends,
    I am using labview 8.6. The condition terminal of the while loop and conditional for loop is behaving in just the opposite way.
    When i wire a true to the condition terminal of my loop, the while loop continues to run when I click on run. when I wire a FALSE, it stops.
    Is there any setting change that I have to make it to get it work properly.
    Please suggest on this.
    Thanks and regards,
    Herok

    Please do NOT attach .bmp images with the extension changed to .jpg to circumvent the forum filters!
    Herok wrote:
    I am sending you the VI. I am not sure if this would help you because only in 2 computers this behaviour is seen. In others, it works as it is supposed to work.
    Whatever you are seeing must be due to some corruption or folding error. It all works fine here.
    To make sure there are no hidden objects, simply press the cleanup button which would reveal any extra stuff (which is obviously not there). Does it fix itself if you click the termination terminal an even number of times? What if you remove the bad loop and create a new one?
    Could it be you have some problems with the graphics card and the icon of the conditional terminal does not update correctly?
    Whay happens if you connect a control instead of a diagram constant?
    What is different on the computers where it acts incorrectly (different CPU (brand, model), #of cores, etc.) 
    LabVIEW Champion . Do more with less code and in less time .

  • Geting ORA 936 -while building dynamic query in for loop.

    HI,
    I hav written a SP and its compiled and giving me the results for the data I am quering but giving ORA936 - missing expressin and giving ORA 6512 at 2 lines. Please help me me out where I am going wrong.
    CREATE OR REPLACE TYPE LIST as VARRAY(5000) of NUMBER;
    CREATE OR REPLACE PROCEDURE test( V_id IN LIST,
    v-fdate IN DATE,
    v-tdate IN DATE,
    v_flg IN CHAR)
    AS
    TYPE opfld IS RECORD (
    FID TAB.ID%TYPE,
    FCURR TAB.CURR %TYPE,
    FCNT TAB.CNT%TYPE,
    FTOT TAB.TOT%TYPE );
    TYPE OPLIST IS REF CURSOR;
    Rc oplist;
    Edtab opfld;
    Selstr VACHAR2(200);
    Whstr1 VACHAR2(200);
    Whstr2 VACHAR2(200);
    Whstr3 VACHAR2(200);
    Whstr VACHAR2(200);
    Grpstr VACHAR2(200);
    Andstr VACHAR2(200);
    Fullstr VACHAR2(200);
    BEGIN
    Selstr := ‘SELECT col1,col2,sum(col3),sum(col4) from tab1 ’;
    Whstr1 := ‘ WHERE tdate BETWEEN TO_DATE(‘||’’’’||vfdate||’’’’||’)’;
    Whstr2: = ‘ AND TO_DATE(‘||’’’’||vtdate||’’’’||’)’;
    Whstr := whstr1||whstr2;
    Grpstr := ‘GROUP BY col1,col2’;
    IF v_flg IS NOT NULL THEN
    Whstr3 := whstr||’AND FLAG = ‘||v_flg;
    else
    Whstr3 := whstr ;
    END IF;
    FOR I IN 1..id.COUNT LOOP
    BEGIN
    Andstr := ‘ AND id =’|| v_id(i);
    Whstr := whstr3 || andstr ;
    Fullstr := selstr||whstr||grpstr;
    OPEN rc for fullstr;
    LOOP
    FETCH rc into edtab
    EXIT when rc%NOTFOUND;
    END LOOP;
    Andstr := ‘’;
    Whstr :=’’;
    END; ---BEGIN of FOR loop
    END LOOP; -- for end
    CLOSE rc;
    END; -- proc end
    Created above SP and its compiled. When I try to execute the SP with below code I am getting--
    DECLARE
    V_t LIST;
    BEGIN
    V_t:= LIST();
    V_t.EXTEND(10);
    V_t(1) := 10;
    V_t(2) := 20;
    Test(v_t,’25-APR-2012’,’30-APR-2012’,’Y’);
    END;
    The SP is building correct dynamic querry and its getting executed for id = 10 and 20, giving the correct results but though I defined only 2 ids while executing and written FOR lOOP upto ID.COUNT its building query for third time and that time its not getting id, so for the third time the last part of where clause is built like
    SELECT.....
    WHERE....
    AND id = (its taking blank here)
    GROUP BY ...;
    and thus its giving me ORA 936 missing expression and ORA 06152 at line of RECORD TYPE declaration and line of OPEN rc for fullstr;
    ERROR at line 1
    ORA 00936 misssing expresiion
    ORA 006152 at line 9
    ORA 006512 at line 87
    I hav put DBMS_OUTPUT statements @ every build of dynamic wuery and its correct. here I have not copid the code I hav typed hereso not wriiten DBMS_OUTPUT.
    I tried lot of ways redefining Andstr := ‘’;
    Whstr :=’’; after for endloop but its giving the same error. is this because I am using varray? If am providing 2 ids in anonymous block then how its building query for third blank ID value.
    Please help me out here..
    Thanks a lot..

    >
    I hav written a SP and its compiled and giving me the results for the data I am quering
    >
    Then you should have posted the one that compiles and gives you results.
    The code you posted will not compile without errors. Edit your original post and provide the corrected code.
    When you do please add \ tags on the line before and after the code to preserve formatting. See the FAQ for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Having trouble with inner for loop values in my procedure

    Hi ...
    I am using oracle 10g and here is my procedure ...
    create or replace procedure sales_information is
    v_qty number(10);
    rem_qty number(10):=0;
    cursor pck_quantity is
    select * from sales_info;
    cursor no_of_labels is
    select ceil(sum(nvl(total_quantity,actual_quantity))/400) from sales_info;
    begin
    for j in no_of_labels
    loop
    for i in pck_quantity
    loop
    select nvl(i.total_quantity,i.actual_quantity) into v_qty from sales_info;
    if v_qty>=i.packed_quantity and rem_qty=0 then
    insert into sales_order values------------
    rem-qty:=v_qty-i.packed_quantity;
    v_qty:=rem_qty;
    exit;
    else if v_qty>=i.packed_quantity and rem_qty>=400 then
    insert into sales_order values-----------
    rem_qty:=v_qty-rem_qty;
    v_qty:=rem_qty;
    exit;
    else if v_qty>=i.packed_quantity and rem_qty>0 then
    rem_qty:=v_qty+rem_qty-i.packed_quantity;
    v_qty:=rem_qty;
    insert into sales_order values-----------
    else if v_qty is null and rem_qty>0 and then
    insert into sales_order values-----------
    else if v_qty<i.packed_quantity and rem_qty:=0 then
    rem_qty:=v_qty;
    else if v_qty<i.packed_quantity and rem_qty>0 then
    if (v_qty+rem_qty)>400 then
    insert into sales_order values-----------
    rem_qty:=v_qty+rem_qty-i.packed_quantity;
    v_qty:=rem_qty;
    end if;
    end if;
    end loop;
    end loop;
    The inner for loop will retrieve the same values of v_qty for every iteration of outer for loop when it runs the following select statement:
    select nvl(i.total_quantity,i.actual_quantity) into v_qty from sales_info;
    and thus loses the previously computed values of v_qty and rem_qty
    in the previous iteration of outer for loop whereas i want the inner for loop to iterate over it's previously computed values of v_qty and rem_qty but cant think of a workaround.

    h4. Thanks Dave for explanation. Hope I understood your requirement and below code resolves that
    -- Creating table SALES_INFO
    CREATE TABLE SALES_INFO
    (    S_NO             NUMBER(1),
         ACTUAL_QUANTITY  NUMBER(10),
         TOTAL_QUANTITY   NUMBER(10),
          PACKED_QUANTITY  NUMBER(10)
    -- Creating table sales_order
    CREATE TABLE SALES_ORDER
    (    S_NO             NUMBER(1),
         LABEL            VARCHAR2(30),
         ORDER_QUANTITY   NUMBER(10)
    -- Push SALES_INFO data
    INSERT INTO SALES_INFO VALUES(1,1000,800,400);
    INSERT INTO SALES_INFO VALUES(2,800,600,400);
    INSERT INTO SALES_INFO VALUES(3,800,NULL,400);
    INSERT INTO SALES_INFO VALUES(4,NULL,600,400);
    CREATE OR REPLACE PROCEDURE populate_sales_order AS
    CURSOR get_sales_info IS
    SELECT s_no,
               NVL(total_quantity,actual_quantity) total_quantity,
            packed_quantity
    FROM   sales_info;
    v_s_no          PLS_INTEGER := 0;
    v_rem_qty     PLS_INTEGER := 0;
    v_label_num   PLS_INTEGER := 1;
    BEGIN
    FOR rec IN get_sales_info LOOP
        v_rem_qty := rec.total_quantity + v_rem_qty;
        v_s_no    := rec.s_no;
         WHILE v_rem_qty >= rec.packed_quantity LOOP
           INSERT INTO sales_order( s_no, label, order_quantity)
           VALUES ( v_s_no, 'LABEL' || v_label_num, rec.packed_quantity );
           -- Reduce the packed qty from total qty and increment label counter
           v_rem_qty   := v_rem_qty - rec.packed_quantity ;
           v_label_num := v_label_num + 1;
         END LOOP;
    END LOOP;
    -- Put the last lot remaining qty into last carton
    IF v_rem_qty > 0 THEN
    INSERT INTO sales_order( s_no, label, order_quantity)
    VALUES (v_s_no, 'LABEL' || v_label_num, v_rem_qty );
    END IF;
    COMMIT;
    END;
    S_NO    LABEL                                ORDER_QUANTITY
      1          LABEL1                                    400
      1          LABEL2                                    400
      2          LABEL3                                    400
      3          LABEL4                                    400
      3          LABEL5                                    400
      4          LABEL6                                    400
      4          LABEL7                                    400
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • For loop interrupt

    Attached please find my test vi(i use while loop instead of for loop,cause my labview version is 8.2, which don't have interrupt condition item in for loop. )
    i wanted to stop the vi while the vi was running, such as i pressed the stop button when i was 4, the vi wouldn't stop immediately,it first finished the current cycle, gave me the 5th random number and time delay, then it ran the next cycle and gave me the 6th random number and stop, so i had to wait some time(time delay+the 6 cycle duration)since i pressed the button, now i hope someone can give me some advice that don't let the next cycle happen and stop the vi immediately.
    Solved!
    Go to Solution.
    Attachments:
    test.vi ‏13 KB

    413332985 wrote:
    to altenbach:
    thanks for your help,  it's very helpful. But i still have a small problem, your example vi don't creat the first random number immediately, it waits 500 million seconds. If i change the number "500" to a much bigger number, i have to wait a longer time to get the first number, so how can i get the first number immediately while others wait?
    No, that's not correct. The initial timeout is 0, so it generates the first random number immediately. Try it once more.
    Here's a modification that shows it more clearly. Once the program is started, you need to press another button to start with the random numbers. As you see, the first one appears immediately.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    testtimeout2.vi ‏16 KB

  • Cursor for loop in PlSql

    while i was studying about cursor for loop i found this statement in the web
    "A cursor FOR loop implicitly declares its loop index as a %ROWTYPE record"
    for example an emp table contain following columns empno,ename,sal,hiredate,deptno
    and let us consider an cursor for loop as
    for rec in select empno,sal from emp loop
    if cursor for loop declare loop index as a %rowtype our cursor statement should include all the columns and follow the data type compatabulity.
    But here our cursor statement includes only few columns,if we use %rowtype we have to select all columns but here we are not doing this.
    Can anyone please explain what is happening in cursor for loop?

    for loop cursor is also like the simple explicite cursor..
    the cursor variable will hold only the columns that are given in select statement of the cursor..
    if u declare a cursor as %rowtype, then it should include all the columns of that particular table..
    otherwise u should use only %type for each and every column seperately only...

  • Config data refnums invalidate​d by for loop

    I have found the following problem with LabVIEW 7.0. This only occurs when running the application as built with the application builder and does not appear to be a problem in the development environment.
    Given an open refnum for a config file one can loop through several read key operations while passing the data and the refnum to outputs on the for loop. If you disable indexing on the refnum output of the for loop you should get a usable refnum out. What happens instead when you try to close the refnum is an error indicating that the refnum is invalid. If you simply route the refnum around the loop avoiding the for loop output altogether this doesn't happen. It appears that somehow, going through the indexing output of the f
    or loop invalidates or changes the refnum when in a built application using the runtime.
    If anyone can reproduce this or prove me wrong it would be helpful. This bug cost me days of chasing down why my "major app" would only work when in development but fail when built. The lack of debug capability in a built app of course leant to the effort that it took to track this down.
    Thanks,

    Hello, i'm french so scuse for my writting...
    I don't find where put this question so i writte here.
    I want to do a soft who's objective is to writte config data (open config data + write key + close..).
    you can find it in the join piece.
    this soft run correctly but when i do an exe with the application builder, when i try to run the exe, that saying me error 7 about the Nex file in Open config data...
    How can i solve this problem???
    Tanks for all....
    Attachments:
    chconfexe.vi ‏32 KB

  • How to stop a "for" loop

    Hello,
    Do you know how I can stop a for loop ? because when I click on the stop switch on my front panel, the VI don't stop and continue to run the loop.
    Peter.
    Labview 2010
    Solved!
    Go to Solution.

    Peter,
    It sounds like you need a while loop, not a for loop. A button or switch does not traditionally control iterations of execution for a for loop.
    Please post your code so we may help better.
    -Chazzmd

  • Reading a csv file within a for loop

    Hi guys,
    Im trying to read a csv file within a for loop and the while loop only seems to be getting executed once rather than the number of times that is specified.
    for(int i=0; i<paramValues.length;i++)
    String StudentNo = paramValues4;
    out.println("StudentNo="+StudentNo);
    BufferedReader in = new BufferedReader( new InputStreamReader( conn2.getInputStream()));
    String readLine;     // stores a line from the file as a string//used to get rid of the first line which has course name
                                                      readLine = in.readLine();
                                                                     int NumberOfElementsInArray=16;
                                                           String[] data;
                                                                     data = new String[NumberOfElementsInArray];
                                                                     data[0]=> StudentNo
                                                                     data[1]=> Surname
                                                                     data[2]=> Firstname
                                                                     data[3]=> ExamNo
                                                                     data[4]=> YrOfStdy
                                                                     data[5]=> ProgOfStdy
                                                                     data[6]=> Fld1
                                                                     data[7]=> Fld2
                                                                     data[8]=> DegType
                                                                     data[9]=> EnrolStatus
                                                                     data[10]=> StaffAdvNo
                                                                     data[11]=> Tutor
                                                                     data[12]=> Fld3
                                                                     data[13]=> Fld4
                                                                     data[14]=> Fld5
                                                                     data[15]=> Pegged
                                                                     data[16]                                                            
                                                                     //out.println("<table border=\"1\">");
                                                                     int datanumber=0;
                                                                     while( (readLine = in.readLine()) != null )     
                                                                          out.println("ive entered the loop");                                                       
                                                                          StringTokenizer tokens = new StringTokenizer( readLine, ",", true);                    
                                                                          boolean prevTokenComma = true;
                                                                          boolean emptyValue = false;
                                                                          String aValue = null;
                                                                          datanumber=0;                                                                      
                                                                          while( tokens.hasMoreTokens() )          
                                                                               aValue = null;
                                                                               String token = tokens.nextToken();
                                                                               token=token.trim();
                                                                               //if the token does not equal to a comma
                                                                               if( !token.equals(",") )               
                                                                                    aValue = token;                    
                                                                                    prevTokenComma = false;                    
                                                                                    emptyValue = false;     
                                                                               else if( token.equals(",") && prevTokenComma )               
                                                                                    prevTokenComma = true;                    
                                                                                    emptyValue = true;               
                                                                               else //( token.equals(",") && !prevTokenComma )               
                                                                                    prevTokenComma = true;                    
                                                                                    emptyValue = false;
                                                                               if(emptyValue)
                                                                                    aValue = "";
                                                                               // Printing values
                                                                               if( aValue == null)
                                                                                    //do nothing
                                                                               else if (aValue.equals("") )
                                                                                    aValue="&nbsp";
                                                                                    data[datanumber]=aValue;
                                                                                    //out.println("datanumber="+datanumber);
                                                                                    //out.println("<td> aValue: "+aValue+"</td>");
                                                                                    datanumber++;
                                                                               else
                                                                                    data[datanumber]=aValue;
                                                                                    //out.println("<td> aValue: "+aValue+"</td>");
                                                                                    //out.println(datanumber);
                                                                                    datanumber++;                                                                                
                                                                          out.println("data[0]="+data[0]);
                                                                          //out.println("data[3]="+data[3]);
                                                                          //out.println("ExamNo="+ExamNo);
                                                                     }//end while
                                                                     in.close();
    }//end for loop
    When I print the variable student no at the beginning of the for loop it prints the different studentno's so the for loop is fine, but the while loop gets executed once. Does anyone know why????????/
    Thanks
    Tzaf

    PROBLEM SOLVED....
    Basically the following declarations have been done within the for loop....
    URL url2 = new URL ("http://localhost:8080/FYP/CSVFILES"+Year+"/"+WebCourse2+".csv");
                                                                     URLConnection conn2 = url2.openConnection();
                                                                     HttpURLConnection uc = (HttpURLConnection)conn2;
                                                                     uc.connect();
                                                                     try
                                                                          responseCode = uc.getResponseCode();
                                                                          out.println("Response code1: " + responseCode+"\n");
                                                                     catch(IOException e)
                                                                          responseCode = uc.getResponseCode();
                                                                          //out.println("Response code2: " + responseCode+"\n");
    thanks
    anyway
    tzaf

  • For loop to iterate through temp table in store procedure in pl/sql

    Hi,
    how to create For loop to iterate through the temporary table in the store procedure?

    Neha RK wrote:
    hi,
    its not working , i need to check each record of table and do some task using if else loop inside that for..
    if not possible to loop each row of table using for then how to use while loop.
    please helpWhat's not working? We haven't got psychic powers so we can't see the code you say isn't working.
    Please provide more information like create table statements, insert statements with test data, the code you've tried
    and the output you are expecting from the input data.
    Read {message:id=9360002} and follow the advice there.

Maybe you are looking for