Home » SQL & PL/SQL » SQL & PL/SQL » SQL Query for Oracle Datatbase
SQL Query for Oracle Datatbase [message #420945] Thu, 03 September 2009 07:41 Go to next message
Messages: 17
Registered: September 2009
Junior Member

I have a table called CallsLogged with a column called EnteredOn.
The data in this column is a date in unix Time Stamp format.
I need to write a SQL query to retrieve all entries where the value of "EnteredOn" is Today.

At the minute the query looks like this:

FROM CallsLogged
WHERE EnteredOn BETWEEN DATEDIFF(Second, '19700101', DATEADD
                        (Day, DATEDIFF(Day, 0, CURRENT_TIMESTAMP), 0)) AND DATEDIFF
                        (Second, '19700101', DATEADD(Day, DATEDIFF(Day, 0, CURRENT_TIMESTAMP)+1, 0)) -1

This works great on a SQL Server Database but I need it to work on an Oracle Database.

I am getting the error 'DATEDIFF: invalid identifier'

Can anyone help translate this code into an oracle SQL query
Re: SQL Query for Oracle Datatbase [message #420948 is a reply to message #420945] Thu, 03 September 2009 07:55 Go to previous message
Michel Cadot
Messages: 65089
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Database SQL Reference contains the list of Oracle SQL functions and DATEDIFF does not exist.
You can direclty subtract 2 dates in Oracle using minus sign.


[Updated on: Thu, 03 September 2009 07:57]

Report message to a moderator

Next Topic: SQL Query to get a time index
Goto Forum:

Current Time: Thu Jul 27 04:04:07 CDT 2017

Total time taken to generate the page: 0.12561 seconds