Introduction

OR operator returns TRUE if either operand is TRUE.

Demo

SQL>
SQL> CREATE OR REPLACE PROCEDURE print_boolean (
  2    b_name   VARCHAR2,-- ww w .  ja v  a 2 s .co m
  3    b_value  BOOLEAN
  4   ) IS
  5  BEGIN
  6    IF b_value IS NULL THEN
  7      DBMS_OUTPUT.PUT_LINE (b_name || ' = NULL');
  8    ELSIF b_value = TRUE THEN
  9      DBMS_OUTPUT.PUT_LINE (b_name || ' = TRUE');
 10    ELSE
 11      DBMS_OUTPUT.PUT_LINE (b_name || ' = FALSE');
 12    END IF;
 13  END;
 14  /

Procedure created.

SQL>
SQL> DECLARE
  2    PROCEDURE print_x_or_y (
  3      x  BOOLEAN,
  4      y  BOOLEAN
  5    ) IS
  6    BEGIN
  7      print_boolean ('x', x);
  8      print_boolean ('y', y);
  9      print_boolean ('x OR y', x OR y);
 10    END print_x_or_y;
 11
 12  BEGIN
 13    print_x_or_y (FALSE, FALSE);
 14    print_x_or_y (TRUE, FALSE);
 15    print_x_or_y (FALSE, TRUE);
 16    print_x_or_y (TRUE, TRUE);
 17
 18    print_x_or_y (TRUE, NULL);
 19    print_x_or_y (FALSE, NULL);
 20    print_x_or_y (NULL, TRUE);
 21    print_x_or_y (NULL, FALSE);
 22  END;
 23  /
x = FALSE
y = FALSE
x OR y = FALSE
x = TRUE
y = FALSE
x OR y = TRUE
x = FALSE
y = TRUE
x OR y = TRUE
x = TRUE
y = TRUE
x OR y = TRUE
x = TRUE
y = NULL
x OR y = TRUE
x = FALSE
y = NULL
x OR y = NULL
x = NULL
y = TRUE
x OR y = TRUE
x = NULL
y = FALSE
x OR y = NULL

PL/SQL procedure successfully completed.

SQL>

Related Topic