Oracle: Get All Month or Week Days Names

To get All Month Names
select
    to_char(add_months(to_date('01-Jan-2001','dd-Mon-yyyy'),level -1),'Month') MonthName
from
    dual
connect by level <= 12;


To get all week days names
select
 to_char(trunc(sysdate ,'day')+level-1,'day') days
from
 dual
connect by level<8


To generate a numeric sequence
select
 level
from
 dual
connect by level<= 1000

or

select
 rownum
from
 dual
connect by rownum <= 1000


Related Posts:

ORA-01436: CONNECT BY loop in user data
http://nimishgarg.blogspot.in/2011/02/ora-01436-connect-by-loop-in-user-data.html

Connect By Prior (Hierarchical Query)
http://nimishgarg.blogspot.in/2010/02/oracle-connect-by-prior-hierarchical.html

Alpha Numeric Counter Or Sequence
http://nimishgarg.blogspot.in/2011/04/alpha-numeric-counter-or-sequence.html

Oracle: Fibonacci Series by SQL
http://nimishgarg.blogspot.in/2010/08/oracle-fibonacci-series-by-sql.html

Oracle SQL: Triangular Series (1 3 6 10 15 21)
http://nimishgarg.blogspot.in/2010/07/oracle-sql-triangular-series-1-3-6-10.html

4 comments:

  1. select level
    from dual
    connect by level <= 12;

    this query is number generator 1 to 12

    ReplyDelete
  2. The district also reviewed cellphone video of
    Spruill acquiring a lap dance from a student at the celebration.

    ReplyDelete
  3. Hi there, I check your new stuff regularly. Your writing style is witty, keep up
    the good work!

    ReplyDelete
  4. hi.. how to display all dates and day name of a given year using oracle sql

    ReplyDelete