Saturday, 11 August 2018

Oracle / PLSQL: IF-THEN-ELSE-IF-ELSE Statement

SET SERVEROUTPUT ON;

DECLARE
   a number(3) := 100;
BEGIN
   IF (a = 50 ) THEN
      dbms_output.put_line('Value of a is 80' );
   ELSIF ( a = 75 ) then
      dbms_output.put_line('Value of a is 76' );
   ELSE
       dbms_output.put_line('None of the values is matching');
   END IF;
   dbms_output.put_line('Real value of a is: '|| a );
END;

/

No comments:

Post a Comment

Oracle / PLSQL: FOR LOOP

set serveroutput on; declare a1 varchar2(100); begin select count(*) into a1 from employees; for i in 1..a1 loop dbms_output.put_line...