Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Statements
 

An example of comparison of two numbers using a searched CASE expression

SQL> SQL> declare   2    a number :=20;   3    b number :=-40;   4    string varchar2(50);   5  begin   6    string :=case   7               when (a>b)then 'A is greater than B'   8               when (a<b)then 'A is less than B'   9             else  10               'A is equal to B'  11             end;  12    dbms_output.put_line(string);  13  end;  14  / A is greater than B PL/SQL procedure successfully completed. SQL>