The IF...THEN...ELSE command executes one or more statements in a program when a specified condition is met. Optionally, it also executes an alternative statement or group of statements when the condition is not met. You can use IF only within programs.
Syntax
IF boolean-expression
THEN statement1
[ELSE statement2]
Arguments
boolean-expression
Any valid Boolean expression that returns either TRUE or FALSE.
THEN statement
Oracle OLAP executes the statement1 argument when the Boolean expression is TRUE. The statement1 must be on the same line as THEN.
ELSE statement
Oracle OLAP executes the statement2 argument when the Boolean expression is FALSE. The statement2 must be on the same line as ELSE. When you omit the ELSE phrase, execution continues with the statement after the whole IF...THEN... statement in the program.
example:
IF grade='E' THEN
dbms_output.put_line("excellent");
ELSE
dbms_output.put_line("AVERAGE");
END IF;