#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    30
    Rep Power
    1

    How do I make a command loop three times?


    Ok, I have code that creates a sequence and a select statement that generates the next number in a sequence. It starts the sequence at 5 and every subsequent number is the previous number minus 3. The minimum value it can go to is 0. All I want is for my select statement to execute three times in a row. Is there any way I can do that?


    Code:
    create sequence MY_FIRST_SEQ
    increment by -3
    maxvalue 5
    start with 5
    minvalue 0
    nocycle;
    
    select MY_FIRST_SEQ.NEXTVAL from dual;
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,027
    Rep Power
    4210
    this smells a lot like oracle

    would you like me to move this question to the oracle forum?
    r937.com | rudy.ca
    please visit Simply SQL and buy my book
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    30
    Rep Power
    1
    I have, but haven't gotten any replies.
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,027
    Rep Power
    4210
    Originally Posted by darthvader45
    I have, but haven't gotten any replies.
    not within the last two weeks that i can see

    thread moved
    r937.com | rudy.ca
    please visit Simply SQL and buy my book
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    30
    Rep Power
    1
    Originally Posted by r937
    not within the last two weeks that i can see

    thread moved
    Oh, the DevShed one? Didn't see that at first, thanks.



    Edit: I don't seem to be getting any further replies. Can someone please assist me with this issue that is posted in the op(original post)?
  10. #6
  11. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    834
    Rep Power
    387
    Originally Posted by darthvader45
    Ok, I have code . . .
    . . .. All I want is for my select statement to execute three times in a row. Is there any way I can do that?

    Code:
    select MY_FIRST_SEQ.NEXTVAL from dual;
    Just hit forward slash (/) two more times.

IMN logo majestic logo threadwatch logo seochat tools logo