Sunday, December 19, 2010

IF-THEN-ELSE-END IF Statement

SET SERVEROUTPUT ON
SET VERIFY OFF
DECLARE
 v_user_input_date  DATE  :=  TO_DATE('&user_input_date', 'DD-MON-YYYY');
 v_day VARCHAR2(10);
BEGIN
 v_day :=  TO_CHAR(v_user_input_date,'DAY');
 IF  v_day like 'S%'  THEN
  DBMS_OUTPUT.PUT_LINE( v_user_input_date || ' falls on weekend' );
 ELSE
  DBMS_OUTPUT.PUT_LINE( v_user_input_date || ' does not fall on weekend');
 END IF;
END;
/
Enter value for user_input_date: 18-DEC-2010
18-DEC-10 falls on weekend

PL/SQL procedure successfully completed.

No comments:

Post a Comment

External Table

Oracle External Table External tables are defined as tables that do not resides in the database allows you to access data that is stor...