CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Other Databases (http://www.codingforums.com/forumdisplay.php?f=38)
-   -   ORACLE: DatePart?? (http://www.codingforums.com/showthread.php?t=277071)

WolfShade 10-15-2012 08:00 PM

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,

Fou-Lu 10-15-2012 10:25 PM

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.

crewson548 10-25-2012 12:58 PM

Is that true for Backups and replicating the database are bigger and slower..
Plz anyone suggest me..

guelphdad 10-25-2012 09:19 PM

crewson, your question has nothing to do with this thread please start a separate thread.


All times are GMT +1. The time now is 01:00 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.