(Challenge) you went to a video store and rented a DVD that is due in 3 days from the rental date. Input rental date, rental month and rental year. Caclculate and print return date, return month and return year.
For example,
```
SQL> DECLARE
2 d NUMBER(2) := &rent_date;
3 m NUMBER(2) := &rent_month;
4 y NUMBER(4) := &rent_year;
5 retd NUMBER(2);
6 retm NUMBER(2);
7 rety NUMBER(4);
8 days NUMBER(2);
9 BEGIN
10 retd := d + 3;
11 retm := m;
12 rety := y;
13 IF m=2 AND ((MOD(y,4)=0 AND MOD(y,100)!=0) OR MOD(y, 400)=0)THEN
14 days := 29;
15 ELSIf m=2 THEN
16 days := 28;
17 ELSIF m=1 OR m=3 OR m=5 OR m=7 OR m=8 OR m=10 OR m=12 THEN
18 days := 31;
19 ELSIF m=4 OR m=6 OR m=9 OR m=11 THEN
20 days := 30;
21 END IF;
22 IF retd > days THEN
23 retd := retd - days;
24 retm := retm + 1;
25 IF retm > 12 THEN
26 retm := 1;
27 rety := rety + 1;
28 END IF;
29 END IF;
30 DBMS_OUTPUT.PUT_LINE('RENT DATE: '||d||'/'||m||'/'||y);
31 DBMS_OUTPUT.PUT('RETURN DATE: '||retd||'/'||retm||'/'|| rety);
32 END;
33 /
Enter value for rent_date: 2
Enter value for rent_month: 12
Enter value for rent_year: 2003
RENT DATE: 2/12/2003
RETURN DATE: 5/12/2003
PL/SQL procedure successfully completed.
SQL> /
Enter value for rent_date: 27
Enter value for rent_month: 2
Enter value for rent_year: 2000
RENT DATE: 27/2/2000
RETURN DATE: 1/3/2000
PL/SQL procedure successfully completed.
SQL> /
Enter value for rent_date: 30
Enter value for rent_month: 12
Enter value for rent_year: 2003
RENT DATE: 30/12/2003
RETURN DATE: 2/1/2004
PL/SQL procedure successfully completed.
```
You might also like to view...
Which of the following is a spyware product?
A) Gator B) Red Sheriff C) Trinity D) Net Bus
A5:E10 is an example of a(n) ________
Fill in the blank(s) with correct word
When you purchase content for devices protected by ____________________, the content is often locked so that it can only be used on your device.
Fill in the blank(s) with the appropriate word(s).
A ________ is a sequence of characters that is considered an object in JavaScript
Fill in the blank(s) with correct word