SQL>
SQL> SET ECHO ON
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 payment_due_date DATE;
3 BEGIN
4 payment_due_date := TRUNC(SYSDATE);
5
6 DBMS_OUTPUT.PUT_LINE('Today is ' || TO_CHAR(SYSDATE,'dd-Mon-yyyy'));
7 DBMS_OUTPUT.PUT_LINE('Payment is due on ' || TO_CHAR(payment_due_date,'dd-Mon-yyyy'));
8
9 IF TRUNC(payment_due_date) = TRUNC(SYSDATE) THEN
10 DBMS_OUTPUT.PUT_LINE('Wrong! Payment is due today!');
11 ELSE
12 DBMS_OUTPUT.PUT_LINE('Wrong! Payment can wait a while.');
13 END IF;
14
15 END;
16 /
Today is 02-Jun-2007
Payment is due on 02-Jun-2007
Wrong! Payment is due today!
PL/SQL procedure successfully completed.
SQL>
|