Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Statements
 

IF ELSE statements

Using ELSE in a Condition Statement IF <condition> then    ...<<set of statements>>... else    ...<<set of statements>>... end if; SQL> SQL> create or replace function f_isSunday (in_dt DATE)   2  return VARCHAR2   3  is   4      v_out VARCHAR2(10);   5      v_flag_b BOOLEAN;   6  begin   7      if to_char(in_dt,'d')=1 then   8          v_out:='Y';   9      else  10          v_out:='N';  11      end if;  12      return v_out;  13  end;  14  / Function created.