December 2010
Intermediate to advanced
451 pages
11h 16m
English
You want to add a number of days to a given date. For example, you are developing an application that calculates shipping dates for a company's products. In this case, your application is processing shipments, and you need to calculate a date that is 14 days from the current date.
Treat the number of days as an integer, and add that integer to your DATE value. The following lines of code show how this can be done:
DECLARE
ship_date DATE := SYSDATE + 14;
BEGIN
DBMS_OUTPUT.PUT_LINE('The shipping date for any products '||
'that are ordered today is ' || ship_date);
END;
The result that is displayed for this example will be 14 days past your current date.
Read now
Unlock full access