Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add days Oracle SQL

Tags:

sql

oracle11g

SELECT ORDER_NUM, CUSTOMER_NUM, CUSTOMER_NAME, ADD_DAYS (ORDER_DATE, 20) FROM CUSTOMER, ORDERS;  

Oracle Express says ADD_DAYS invalid? Any ideas what Am I doing wrong?

like image 585
SQL_Student Avatar asked Dec 12 '14 20:12

SQL_Student


People also ask

How do I add days to a date in SQL Developer?

Description Adding days to a date column is very simple within Oracle, you just add the number to the date and Oracle handles spanning the months (and years). Note this is for date columns, not timestamps.

Can we add two dates in Oracle?

Adding two dates is meaningless. You can add an interval to a date.

What is Dateadd in Oracle?

Use this function to add a specified number of days, months, and/or years to a date.

What does ADD_MONTHS do in SQL?

The ADD_MONTHS function takes a DATETIME or DATE expression as its first argument, and requires a second integer argument, specifying the number of months to add to the first argument value. The second argument can be positive or negative.


2 Answers

If you want to add N days to your days. You can use the plus operator as follows -

SELECT ( SYSDATE + N ) FROM DUAL; 
like image 70
mkumawat10 Avatar answered Sep 28 '22 16:09

mkumawat10


You can use the plus operator to add days to a date.

order_date + 20 
like image 41
Mike Avatar answered Sep 28 '22 15:09

Mike