Boolean value function parameter : Function Parameters « Stored Procedure Function « Oracle PL / SQL






Boolean value function parameter

   
SQL>
SQL> create or replace
  2  function ite(
  3    p_expression boolean,
  4    p_true varchar2,
  5    p_false varchar2 ) return varchar2 as
  6  begin
  7    if p_expression then
  8        return p_true;
  9    end if;
 10    return p_false;
 11  end ite;
 12  /

Function created.

SQL>
SQL>  set serverout on
SQL>
SQL>
SQL>  exec dbms_output.put_line( ite( 1=2, 'Equal', 'Not Equal' ) );
Not Equal

PL/SQL procedure successfully completed.

SQL>
SQL>  exec dbms_output.put_line( ite( 2>3, 'True', 'False' ) );
False

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL>

           
         
    
    
  








Related examples in the same category

1.Pass value to function parameter
2.The FullName Function
3.A stored function with no parameters.
4.Use Column type as the function parameter type
5.Varray type parameter
6.Clob type parameter
7.Positional Notation
8.Get circle area
9.Named Notation
10.Pass number value to function
11.Mixed Name and Position Notation Calls