Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a NUMBER to a DATE 1

Status
Not open for further replies.
Jun 12, 2003
16
CA
Hi,

I'm new to Oracle and SQL Plus so try to bare with me please.

I have the following tables, Classes and Classrooms, which are connected via an attribute called 'Room_No'.

An attribute of Classes is 'Start_Date' which is of DATE datatype. An attribute of Classes is 'Length' which is of NUMBER datatype.

What I need to do is run a query that will list all the classrooms the are not occupied after August 15, 2004. The query has to take into account the length of course. For example, if a course's 'Start_Date' is 15-AUG-2004 and has a length of 2 then it's end date would be 17-AUG-2004 and should not be included in the list.

My main questions is, can you add a number to a date or days to a date? If so, can I just use the '+' operator or is there a function that I am supposed to use.

Thanks in advance!
 
You can just add a number to a date, the result will be exactly what you need. The number is treated as number of days (not neccessarily integer) added to the date.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top