ELSIF Statements
0ELSIF Statements:
Syntax:
IF Condition1 THEN
Statement1;
ELSIF Condition2 THEN
Statement2;
ELSIF Condition3 THEN
Statement3;
ELSE
Statementn;
END IF;
SQL>DECLARE
v_TotalEmps NUMBER;
BEGIN
SELECT COUTN(*)
INTO v_TotalEmps
FROM emp;
IF v_TotalEmps=0 THEN
INSERT INTO temp_table values(‘There are no emps’);
ELSIF v_TotalEmps <5 THEN
INSERT INTO temp_table values(‘There are few emps joined’);
ELSIF v_TotalEmps <10 THEN
INSERT INTO temp_table values(‘There are little more emps joined’);
ELSE
INSERT INTO temp_table values(‘There are many emps joined’);
END IF;
END;
0 comments: