ELSIF Statements

0

ELSIF 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;


 Click here to go to Back page

About the author

Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus. Aenean fermentum, eget tincidunt.

0 comments:

Recent Posts