Labeled CASE Statements

0

Labeled  CASE Statements:
  • A CASE statement can optionally be labelled, like a PL/SQL block.
  • If a CASE statement is labelled, then the label can also appear after the END CASE clause.
SQL>DECLARE
        v_TestVar NUMBER:=10;
    BEGIN
        <<Mycase>>
        CASE v_TestVar
        WHEN 10 THEN
        DBMS_OUTPUT.PUT_LINK(‘ACCOUNTING’);    
WHEN 20 THEN
        DBMS_OUTPUT.PUT_LINK(‘RESEARCH’);
        WHEN 30 THEN
        DBMS_OUTPUT.PUT_LINK(‘SALES’);
WHEN 40 THEN
        DBMS_OUTPUT.PUT_LINK(‘OPERATIONS’);
        END CASE Mycase;
    END;

SQL>Create or replace procedure display(s varchar2)
    IS
    DBMS_OUTPUT.PUT_LINE(S);
    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