Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts

    ORACLE: DatePart??

    Hey, everyone.

    Been scouring Google, looking for an ORACLE equivalent to SQL Server "DatePart". I found one thing, and it's not working:

    Code:
    SELECT ...
    FROM ...
    WHERE DatePart(tbl.DateField,DP_YEAR) = 2012
    I keep getting a "DATEPART: invalid identifier" message. This is Oracle 10g.

    Does anyone know the proper way to compare the year portion of a date to a value like "2012"?

    Thank you,
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    DBMS are far from my strong point especially oracle. But I'm not familiar with the DATEPART function. The error indicates that oracle isn't either (maybe a pl/sql specific?). I always use EXTRACT when I need to pull something out of Oracle by year:
    Code:
    EXTRACT(YEAR from tbl.DateField) = 2012
    Looks like it'll do it.

  • #3
    New Coder
    Join Date
    Oct 2012
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Is that true for Backups and replicating the database are bigger and slower..
    Plz anyone suggest me..

  • #4
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,631
    Thanks
    4
    Thanked 147 Times in 138 Posts
    crewson, your question has nothing to do with this thread please start a separate thread.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •