Jan 072013
 
create sequence of_endlessly_repeating_digits 
cache 2 cycle maxvalue 10;

select of_endlessly_repeating_digits.nextval
from   dual 
connect by level <= 100;
I've never found a particularly good use for cycling sequences, but I guess they must come in handy somewhere...

  2 Responses to “Repeating numbers, to infinity and beyond!”

  1. rem dont need a sequence

    select level from dual connect by level <= 100

    • Maybe the meaning of this isn’t as obvious as I hoped…

      The sequence continually cycles between the numbers 1-10, so if you run the script in the post you’ll get these numbers repeated over and over. Whereas using level just gives you the numbers 1-100.

      The point being that sequences can reset and cycle to the beginning again (without you having to do anything).

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)