Extracting month from Date

  • I have to provide month_of_date in my query, I tried following function in Oracle but it gives me error, any other suggestion. Please see my query below.

    SELECT waf.activity_count

    , waf.oid,

    , WAF.EVENT_TYPE

    , WAF.IDENTITY_ID,

    extract (month from WAF.ACTIVITY_DATE)

    FROM GMMI_AIR.web_activity_fct waf

    WHERE 1=1

    AND (WAF.ACTIVITY_DATE)) BETWEEN '1-APR-2010'

    AND '31-MAR-2012'

    I have to show my column as Month_of_date and have no clue how do I extract month in Oracle functions.

    Thanks a bunch!!!

  • Duplicate post. Please direct all replies here.

    Got them backwards, post replies here.

  • daveap (4/17/2012)


    I have to provide month_of_date in my query, I tried following function in Oracle but it gives me error, any other suggestion. Please see my query below.

    SELECT waf.activity_count

    , waf.oid,

    , WAF.EVENT_TYPE

    , WAF.IDENTITY_ID,

    extract (month from WAF.ACTIVITY_DATE)

    FROM GMMI_AIR.web_activity_fct waf

    WHERE 1=1

    AND (WAF.ACTIVITY_DATE)) BETWEEN '1-APR-2010'

    AND '31-MAR-2012'

    I have to show my column as Month_of_date and have no clue how do I extract month in Oracle functions.

    Thanks a bunch!!!

    TO_CHAR(WAF.ACTIVITY_DATE,'MONTH')

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply