Sunday, December 19, 2010

IF-THEN-ELSIF-ELSE-END IF statement

SET VERIFY OFF
SET SERVEROUTPUT ON

DECLARE
 v_user_input NUMBER := &user_input_number;
BEGIN
 IF v_user_input < 0 THEN
  DBMS_OUTPUT.PUT_LINE ( v_user_input || ' is a negative number' );
 ELSIF  v_user_input = 0 THEN
  DBMS_OUTPUT.PUT_LINE ( v_user_input || ' is equal to Zero' );
 ELSE
 DBMS_OUTPUT.PUT_LINE ( v_user_input || ' is a positive number' );
 END IF;
END;
/

Enter value for user_input_number: -24
-24 is a negative number

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