Sunday, December 19, 2010

IF-THEN-END IF Statement

SET SERVEROUTPUT ON
DECLARE
 v_num1  NUMBER  := 40;
 v_num2  NUMBER  := 30;
 v_temp   NUMBER;
BEGIN
 -- If num1 is greater than num2 rearrange their values
 IF  v_num1 > v_num2 THEN
  v_temp := v_num1;
  v_num1 := v_num2;
  v_num2 := v_temp;
 END IF;
 -- Display rearranged values of v_num1 and v_num2
 DBMS_OUTPUT.PUT_LINE( 'v_num1 = '|| v_num1);
 DBMS_OUTPUT.PUT_LINE( 'v_num2 = '|| v_num2);
END;
/
v_num1 = 30
v_num2 = 40

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