Example for IF THEN ELSE statement in Oracle PL/SQL
IF THEN ELSE is used to based on condition, If condition is true then run the statement present in blocks else run statement in else block.
Syntax:
IF <condition> THEN
<statements>
ELSE
<statements>
END IF;
-- You also use ELEIF condition inbetween
IF <condition> THEN
<statements>
ELSIF <condition> THEN
<statements>
ELSE
<statements>
END IF;
Example of IF THEN ELSE Statements:
SET SERVEROUTPUT ON
DECLARE
v_id number(2);
BEGIN
v_id := 1;
IF v_id < 5
dbms_output.put_line('Number is less than 5');
ELSE
dbms_output.put_line('Number is greater or equal to 5');
END IF;
END;
/