1.

Can we label a PL/SQL Loop?

Answer»

The CASE STATEMENT in PL/SQL selects one sequence of statements to execute. The statement USES a selector instead multiple Boolean expression.

The FOLLOWING is the syntax:

CASE selector   WHEN 'value1' THEN Statement1;   WHEN 'value2' THEN Statement2;   WHEN 'value3' THEN Statement3;   ...   ELSE Sn;  -- default case END CASE;

The following is an example:

DECLARE   POINTS number := 100; BEGIN   case points      when 20 then dbms_output.put_line('Rank 4');      when 50 then dbms_output.put_line('Rank 3');      when 75 then dbms_output.put_line('Rank 2');      when 100 then dbms_output.put_line('Rank1... Topper');      else dbms_output.put_line('No ranking!');   end case; END; /

The output:

Rank1... Topper


Discussion

No Comment Found