Home » SQL & PL/SQL » SQL & PL/SQL » Subtract dates (Oracle SQL Developer 3.0.04)
Subtract dates [message #570648] Tue, 13 November 2012 10:57 Go to next message
kestram
Messages: 2
Registered: November 2012
Junior Member
Hello,

New to using Oracle and SQL Developer. I am trying to subtract a maximum date from today and adding back 1 to get a field named daysSinceLastActivity....

Syntax I am trying is (date()-max(activity_date))+1 as daysSinceLastActivity

I keep getting a error message of missing expression. After googling, I am not finding anything that is helping.

Obviously, I am doing something wrong, but I do not understand. This should be a simple calculation.

Any help would be appreciated. Thanks.
Re: Subtract dates [message #570649 is a reply to message #570648] Tue, 13 November 2012 11:05 Go to previous messageGo to next message
BlackSwan
Messages: 22489
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/

>Syntax I am trying is (date()-max(activity_date))+1 as daysSinceLastActivity

Oracle does not have a "DATE()" function
try as below

sysdate-max(activity_date))+1 as daysSinceLastActivity
Re: Subtract dates [message #570650 is a reply to message #570648] Tue, 13 November 2012 11:26 Go to previous messageGo to next message
Michel Cadot
Messages: 58521
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
All functions are described in Database SQL Reference.

Regards
Michel
Re: Subtract dates [message #570652 is a reply to message #570650] Tue, 13 November 2012 11:34 Go to previous message
kestram
Messages: 2
Registered: November 2012
Junior Member
Thanks, that resolved my issue.

I will keep the url for the Database SQL Reference for future questions.
Previous Topic: Pivot
Next Topic: How to update a clob value
Goto Forum:
  


Current Time: Wed Jul 23 23:26:35 CDT 2014

Total time taken to generate the page: 0.12518 seconds