Sunday, December 19, 2010

NESTED IF Statement

SET VERIFY OFF
SET SERVEROUTPUT ON
DECLARE
 v_num1 NUMBER := &num1;
 v_num2 NUMBER := &num2;
v_total NUMBER;
BEGIN
 IF v_num1 > v_num2 THEN
  DBMS_OUTPUT.PUT_LINE ('outer IF ');
  v_total := v_num1 - v_num2;
 ELSE
  DBMS_OUTPUT.PUT_LINE ('outer ELSE');
  v_total := v_num1 + v_num2;
  IF v_total < 0 THEN
   DBMS_OUTPUT.PUT_LINE ('Inner IF');
   v_total := v_total * (-1);
  END IF;
 

 END IF;
 DBMS_OUTPUT.PUT_LINE ('v_total =  '||v_total);
END;
/

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...