1.

Why do we use the TIMESTAMP WITH TIME ZONE datatype in PL/SQL?

Answer»

Yes, this is correct. Here, the WHEN CLAUSE is used for conditions, which are from top to bottom. The SEQUENCE of statements with the WHEN clause whose condition evaluates to TRUE is executed. Only the FIRST statement executes, if more than ONE condition evaluates to TRUE.

The following is the syntax:

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