About exit condition in a loop

I have this loop,
loop
   exit when months_between(sysdate,cur_st)<0;
end loop;is it possible i can modify the exit condition by adding a OR keyword into it?:
e.g.exit when months_between(sysdate,cur_st)<0 OR dbms_random.value(0,1)=0thanks in advance

Moreover, you can use LOOP ... IF... THEN exit; END IF; ... END LOOP or WHILE... LOOP...END LOOP
A try has never been wrong indeed.
Nicolas.
Message was edited by:
N. Gasparotto

Similar Messages

  • Exit condition in loop

    I am putting exit condition in before and after my business logic, so it make any difference
    BEGIN
         FOR REC IN 1..10
         LOOP
              EXIT WHEN REC =5;
              business logic
         END LOOP;
    END;
    BEGIN
         FOR REC IN 1..10
         LOOP
              business logic
              EXIT WHEN REC =5;
         END LOOP;
    END;Thanks
    Edited by: Braam on Oct 11, 2012 10:24 PM

    Would have been quicker for you to test it yourself, than to post the question:
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2     FOR REC IN 1..10
      3     LOOP
      4             EXIT WHEN REC =5;
      5             /*
      6             business logic
      7             */
      8                  dbms_output.put_line('Processing: '||rec);
      9     END LOOP;
    10* END;
    11  /
    Processing: 1
    Processing: 2
    Processing: 3
    Processing: 4
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2     FOR REC IN 1..10
      3     LOOP
      4             /*
      5             business logic
      6             */
      7                  dbms_output.put_line('Processing: '||rec);
      8             EXIT WHEN REC =5;
      9     END LOOP;
    10* END;
    SQL> /
    Processing: 1
    Processing: 2
    Processing: 3
    Processing: 4
    Processing: 5
    PL/SQL procedure successfully completed.

  • Should the condition in the loop step

    Should the condition in the loop step in the integration process(BPM) be = or not= ?I need to do the following>>perform certain operation only when the container value is less than 3 Else then get out of the loop.
    Regards,
    Mansi

    The loop step in ccBPM implements a while loop.
    So, while count not = 3, it will be executed.
    Once the counter reachs 3, the loop will be terminated.
    Regards,
    Henrique.

  • HT2506 Hello guys, I have a question about Preview - How do you loop a slideshow?

    Hello guys, I have a question about Preview - How do you loop a slideshow?

    Had the "loop" feature using Preview in 10.4.11; upgaded to 10.5.8 and it's gone. Don't you have to work at "Taking" it away? Makes no sense. Now you have to look for a third market for something that was included in Preview since the first version was launched.  ....I don't get this one.

  • Can anybody help about the conditions in CRM business transaction??

    Hi experts,
    I'm fresh on CRM and have several questions regarding the conditions in CRM business transactions.
    Can you please help?Thanks in advance.
    In prciing procedure,we can determin which condition should be involved in item level,
       then,how about the conditions in header level??How and where they can be determind?
       how the condition value can be calculated?I think they should be the collection of the conditions of the items.
    Am I right?
    Thanks.

    Hello Jerry
    Basically you are right,  at header level you should see the collection of the conditions of the items. However there are also conditions that can be entered at header level ( header conditions). You can see more information about these conditions in SD documentation:
    http://help.sap.com/erp2005_ehp_05/helpdata/EN/dd/561760545a11d1a7020000e829fd11/frameset.htm
    See sections:
    Header and item conditions
    Distribution Between Header and Items 
    In "Distribution Between Header and Items" you can see how HB00 and RB00 condition types work.  If you create your pricing procedure in CRM ( not downloaded from R3) then you can use 0HB0 and 0RB0, which are the CRM counterparts of HB00 and RB00
    Best Regards
    Luis Rivera

  • ReadUTF() and exiting a server while loop

    What I want to do is simple.. I want to be able to type "exit" into a client and send that message to the server... And exit the server while loop as a result.. Here is what I tried.
    //server code
    while(true)
    //bla bla bla
    //bla bla bla
    String message = socket.readUTF();
    if( message == "exit" )
    break;
    // bla bla bla
    however, when I type exit and send the message, this while loop doesn't break.. I'm new to java so I'm wondering if I'm messing up syntax somewhere.. It seems like it should work fine, whats going on?

    if(message.equals("exit"))

  • Please materials about what condition we use what type of IDOC types and me

    Hi all:
         are there any materials about what conditions we use what  IDOC types and what messsage types?
    would you please give a me a hint ?
         Thank you very much!!!

    Hi
    Check below thread for IDOC
    http://****************/Tutorials/ALE/ALEMainPage.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b828943d711d1893e0000e8323c4f/frameset.htm
    Regards,
    Syf
    Edited by: syfulla shaik on Aug 18, 2008 1:09 PM

  • I want to check the status of application No.  For it is written in my account was canceled and I did not do so I urgent news about his condition and the reason for canceled I redial the same time as the sender befo

    Thank you for your attention
    I want to check the status of application No. W439602096
    For it is written in my account was canceled and I did not do so
    I urgent news about his condition and the reason for canceled
    I redial the same time as the sender before you
    We are waiting for you

    This is a user to user forum. You are not talking to Apple here. We cannot help you; you will need to contact wherever the order was placed.

  • How about use partial key to loop at a hashed table?

    Such as I want to loop a Internal table of BSID according to BKPF.
    data itab_bsid type hashed table of BSID with unique key bukrs belnr gjahr buzid.
    Loop at itab_bsid where bukrs = wa_bkpf-bukrs
                              and    belnr  = wa_bkpf-belnr
                              and    gjahr  = wa_bkpf-gjahr.
    endloop.
    I know if you use all key to access this hashed table ,it is certainly quick, and my question is when i use partial key of this internal hashed table to loop it, how about its performance.
    Another question is in this case(BSID have many many record) , Sorted table and Hashed table , Which is better in performance.

    You can't cast b/w data reference which l_tax is and object reference which l_o_tax_code is.
    osref is a generic object type and you store a reference to some object in it, right? So the question is: what kind of object you store there? Please note - this must be an object reference , not data reference .
    i.e
    "here goes some class
    class zcl_spfli definition.
    endclass.
    class zcl_spfli implementation.
    endclass.
    "here is an OBJECT REFERENCE for it, (so I refer to a class) i.e persistent object to table SPFLI
    data oref_spfli type ref to zcl_spfli.
    "but here I have a DATA REFERENCE (so I refer to some data object) i.e DDIC structure SPFLI
    data dref_spfli type ref to spfli.
    So my OSREF can hold only oref_spfli but it not intended for dref_spfli . That's why you get this syntax error. Once you have stored reference to zcl_spfli in osref then you will be able to dereference it and access this object's attributes.
    data: osref type osref.
    create object osref_spfli.
    osref = osref_spfli.
    "now osref holds reference to object, you can deference it
    oref_spfli ?= osref.
    osref_spfli->some_attribute = ....
    OSREFTAB is just a table whose line is of type OSREF (so can hold multiple object references - one in each line).
    Regards
    Marcin

  • Re: exit from a while loop in sub vi

    I think the mail didn`t get through first time. Repeat posting - Sorry if
    this occurs twice
    Shane
    Hallo,
    Can the use of occurrences solve this problem?
    The Main program can create an occurrence which can be passed to the
    sub-VIs. Upon pressing the button to cancel the loop, the occurrence can be
    set, instantly transmitted to all other VIs sharing which were passed the
    same occurrence. Of course a small handling routine has to be written (say
    a sequence parallel to the executing while loop waiting for the occurrence
    and then setting the exit parameter to "true") but this is trivial.
    I have checked this with a small program splitting an occurrence to three
    seperate VIs and it works.
    If you want, I can send a cop
    y of it.
    It may well be possible with notifiers or something else, but I have far
    less experience with them.
    Hope this helps
    Shane
    >pcu schrieb in Nachricht
    ><[email protected]>...
    >>Main vi has several sub-vi's. Each sub vi has a while loop and Boolean
    >>button. When program runs, sub-vi front panel appears, and I can
    >>stop/continue the while loop. But when I stopped a while loop in a
    >>sub-vi, I cannot control other while loops in other sub vi.
    >>I need exit function from a while loop, not stop function of entire
    >>program.
    >>Thanks.
    >
    >
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

    The notifier is probably better than occurence at this case - than it is not neccessry to write a parallel sequence.
    The use of notifier is very simple, just follow an example in Help/Search example -> Advances -> Execution control -- Synchronization -> SubVI notification.
    Good luck
    Ferda

  • Exit from a while loop in sub vi

    Main vi has several sub-vi's. Each sub vi has a while loop and Boolean button. When program runs, sub-vi front panel appears, and I can stop/continue the while loop. But when I stopped a while loop in a sub-vi, I cannot control other while loops in other sub vi.
    I need exit function from a while loop, not stop function of entire program.
    Thanks.

    Hallo,
    Can the use of occurrences solve this problem?
    The Main program can create an occurrence which can be passed to the
    sub-VIs. Upon pressing the button to cancel the loop, the occurrence can be
    set, instantly transmitted to all other VIs sharing which were passed the
    same occurrence. Of course a small handling routine has to be written (say
    a sequence parallel to the executing while loop waiting for the occurrence
    and then setting the exit parameter to "true") but this is trivial.
    I have checked this with a small program splitting an occurrence to three
    seperate VIs and it works.
    If you want, I can send a copy of it.
    It may well be possible with notifiers or something else, but I have far
    less experience with them.
    Hope this helps
    Shane
    pcu schrieb in Nachr
    icht
    <[email protected]>...
    >Main vi has several sub-vi's. Each sub vi has a while loop and Boolean
    >button. When program runs, sub-vi front panel appears, and I can
    >stop/continue the while loop. But when I stopped a while loop in a
    >sub-vi, I cannot control other while loops in other sub vi.
    >I need exit function from a while loop, not stop function of entire
    >program.
    >Thanks.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • Condition WHERE in LOOP

    Good afternoon,
    I have the following issue,
    I  have that do a LOOP to a table Internal, ie.
    Loop at it_tabla where lgart = '0100' or lgart = '0200' or lgart = '0300' or lgart = '0400' or lgart = '0500' or  lgart = '0600' or lgart = '0700' or lgart = '0800' .
    Endloop.
    The question is, Is there any way , in the which not have that do many or  in the sentence LOOP?
    Kind regards.

    I think Rob means that it will go through the table once.
    It's true for Standard tables.  But as it says in the help on the WHERE clause.
    While with standard tables all rows of the internal table are checked for the logical expression of the WHERE- addition, with sorted tables and hash tables (as of Release 7.0) you can achieve optimized access by checking that at least the beginning part of the table key in sorted tables and the entire table key in hash tables is equal in the logical expression through queries linked with AND. Optimization also takes effect if the logical expression contains other queries linked with AND with arbitrary operators
    In this case though, the queries are linked with OR - so you still get all rows checked! 
    Now, if it_tabla is a sorted table with key lgart, then you could do the following:
    PERFORM read_the_table USING: '0100', '0200',...
    FORM read_the_table USING i_lgart TYPE ...
      data: l_tabix TYPE sytabix.
      READ TABLE it_table WITH TABLE KEY lgart =i_lgart TRANSPORTING NO FIELDS.
      l_tabix = sy-tabix.
      LOOP AT it_table FROM l_tabix INTO ls_wa.
        IF ls_wa-lgart NE i_lgart.
          EXIT.
        ENDIF.
        " Do stuff
      ENDLOOP.
    ENDFORM.
    matt

  • A switch on/off problem about the relay in a loop

    hi group:
    I am developing a project based the Ni-sci-1160. Now I meet a problem about switch on/off in a loop.
    for example:  I creat a loop, and continually check a boolean. if the boolean is true, then the realy is closed, otherwise the relay is open. The problem is when I make the boolean is true,  the corresponding relay is not always on,  but just on-off, on-off,on-off.  I don't know why? Is there any good idea to fix it?
    the easy example codes is attached here , thanks for you help.
    Attachments:
    relay_problem.vi ‏19 KB

    Try moving that first DAQmx function out of the while loop.  Since it is called switch set and Reset, I'm guessing it is resetting the status of the switch every iteration of the while loop which probably means setting it back to false.  It looks like an initialization type of function which means it should only be run once.

  • How do I make something happen only once on a true condition in a loop

    So I have a way of doing this, but it uses a dreaded local variable, and seems to me that it might be unreliable.
    What I want to happen is to have something happen only once on a condition that will remain true. What I need is to set something after a given amount of time, but I only want to set it once after that time has been reached. Problem is, if I use a range, it could be true more than once, if I use a greater than, it'll be true every time after the set time, and if I use an equal, there's no way to know that the particular millisecond value will even appear in the loop.
    Maybe I'm wrong in even using those comparison functions... Any ideas would be greatly appreciated. See the attached vi for a better look at what I'm trying to do... (v7.0)
    Thanks,
    Geoff
    Attachments:
    Question.vi ‏16 KB

    The "Idle" state that the help file refers to is the "non-running"
    state. The Top Level VI must end execution before any "First Time" VIs will
    return TRUE after being called initially.
    Therefore, if your application calls a subVI at the beginning of the
    Test portion, on the next iteration of the loop it will return FALSE
    from that subVI, since your main VI never stopped running, and received
    a TRUE from the "First Time" on the initial test loop.
    If you have code that you want to execute only on the first run of your
    entire program, "First Time" should work fine. If you have code that
    you only want to execute on the first iteration of just the Test loop,
    the "First Time" VI is not ideal.
    I think that shift registers are going to provide the best solution,
    however you mentioned that for your particular application that is not
    ideal. Could you describe a little bit more why shift registers are
    problematic?
    Thanks Geoff, let us know.
    DWeiland
    Applications Engineer
    National Instruments
    www.ni.com/support
    Dan Weiland

  • Change pointer + user exit + condition records

    Hiii
    When creation or modifying condition record that status blank i don't want a change pointer to be generated?
    Note that the KBRST field for status is not present in the BD52 transaction thus filtering cannot be done so as for change pointer to not be generated when condition record with status blank.
    Please advise if this can be done on a user exit?
    Thanks

    Hi,
    your question is not understandable.
    Pls provide more details.
    Cheers,
    André

Maybe you are looking for