The Oracle ELSE keyword is an optional part of the IF...THEN...ELSE conditional construct in PL/SQL, which is used to provide set of alternate statements or execution paths. When the condition specified against IF fails, the program flow proceeds to the ELSE part and the specified statements are executed. After the execution is over, Oracle skips the IF...THEN...ELSE constructs and moves the next statement in the sequence for execution.
For example, the following code checks the age of a person and decides if they are a Senior Citizen or not. If they are older than 60 they are considered to be a Senior Citizen. If the age is less than 60 then the ELSE clause is executed and the string 'Not a Senior Citizen' is printed.
L_AGE NUMBER := 40;
IF L_AGE > 60 THEN
DBMS_OUTPUT.PUT_LINE('Not a Senior Citizen');
Not a Senior Citizen
PL/SQL procedure successfully completed.