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