List all the months using oracle sql .

Posted by Suresh S on Stack Overflow See other posts from Stack Overflow or by Suresh S
Published on 2011-01-03T07:58:13Z Indexed on 2011/01/03 8:53 UTC
Read the original article Hit count: 238

Filed under:
|

Guys is there any better way to list all the months other than this

    select  to_char(add_months(to_date('01/01/1000', 'DD/MM/RRRR'), ind.l-1), 
   'MONTH') as
 month_descr
     ,       ind.l as month_ind
    from    dual descr
    ,       (
              select  l
             from    (select level l from dual connect by level <=
 12)
           ) ind
    order by 2;

ANSWER :

SELECT to_char(add_months(SYSDATE, (LEVEL-1 )),'MONTH') as months FROM dual CONNECT BY LEVEL <= 12

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle