Adsense Ad

Monday, 1 April 2019

Oracle SQL: Query to get Month-Year of current year's sys date and previous months

    select  
    to_char(add_months(trunc(sysdate, 'year'), level - 1), 'MON-YYYY') mon  
    from dual  
    connect by level <= to_number(to_char(sysdate, 'MM'))  
      
    MON  
    --------  
    JAN-2019  
    FEB-2019  
    MAR-2019  
    APR-2019  
   

1 comment:

Atif Zafar said...

It is very helpful. Thanks