1.

How to create a user-defined SUBTYPE in PL/SQL?

Answer»

The WHEN clause has SEARCH conditions that output BOOLEAN values in a searched CASE statement.

The following is the syntax of searched CASE that has the WHEN conditions:

CASE WHEN condition_1 THEN statements_1 WHEN condition_2 THEN statements_2 ... WHEN condition_n THEN statements_n [ ELSE  else_statements ] END CASE;]

Let us see an example:

DECLARE   points number := 100; BEGIN   case        when points = 20 then dbms_output.put_line('Rank 4');      when points = 50 then dbms_output.put_line('Rank 3');      when points = 75 then dbms_output.put_line('Rank 2');      when points = 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