Go Back   CodingForums.com > :: Server side development > MySQL > Other Databases

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-15-2012, 08:00 PM   PM User | #1
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 950
Thanks: 7
Thanked 98 Times in 98 Posts
WolfShade is an unknown quantity at this point
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".
WolfShade is offline   Reply With Quote
Old 10-15-2012, 10:25 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Old 10-25-2012, 12:58 PM   PM User | #3
crewson548
New Coder

 
Join Date: Oct 2012
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
crewson548 is an unknown quantity at this point
Is that true for Backups and replicating the database are bigger and slower..
Plz anyone suggest me..
crewson548 is offline   Reply With Quote
Old 10-25-2012, 09:19 PM   PM User | #4
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
crewson, your question has nothing to do with this thread please start a separate thread.
guelphdad is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:49 AM.


Advertisement
Log in to turn off these ads.