0
SELECT hd.holiday_code, 
       hd.holiday_duration, 
       hdep.departure_date                                    AS 'Start Date', 
       Dateadd(day, hd.holiday_duration, hdep.departure_date) AS 'End Date' 
FROM   holiday_details hd 
       INNER JOIN holiday_departure hdep 
               ON hd.holiday_code = hdep.holiday_code

Well i've been trying to get this specific code ^ to work, but i cant figure out the dateadd syntax. It looks right from what i have research on the googles, but i always get the error ORA-00923: FROM keyword not found where expected

This is usually caused my some minor error on my part, but i cant find it after looking for about 20 minutes. Can anyone point out the error that is probably staring me in the face

4
  • 5
    Dateadd is TSQL not Oracle. Commented Nov 28, 2012 at 22:23
  • Check out the manual for a list of date time functions: docs.oracle.com/cd/E11882_01/server.112/e26088/… Commented Nov 28, 2012 at 22:26
  • Wow me getting my languages confused. Todate? Commented Nov 28, 2012 at 22:26
  • 1
    As I understand it, ORACLE uses INTERVAL notation. hdep.departure_date + INTERVAL hd.holiday_duration 'DAY'. (I worked that out on a phone, with google, and it took longer to type than to find.) Commented Nov 28, 2012 at 22:27

1 Answer 1

2

Simply add the number of days with a numeric value. Another problem with your syntax is in 'Start Date' and 'End Date'; replace single quotes with double quotes. Change your query for something like this:

SELECT hd.holiday_code, 
       hd.holiday_duration, 
       hdep.departure_date AS "Start Date", 
       hdep.departure_date + hd.holiday_duration AS "End Date" 
FROM   holiday_details hd 
       INNER JOIN holiday_departure hdep 
               ON hd.holiday_code = hdep.holiday_code

Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.