Oracle PL/SQL - PL SQL Operator Date Comparisons

Introduction

One date is greater than another if it is more recent. For example, this expression is true:

'01-JAN-91' > '31-DEC-90'

Demo

SQL>
SQL> CREATE OR REPLACE PROCEDURE print_boolean (
  2    b_name   VARCHAR2,-- from   w  w  w .  ja v a2  s.  com
  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> BEGIN
  2    print_boolean ("'01-JAN-91' > '31-DEC-90' ", DATE '01-JAN-91' > DATE '31-DEC-90' );
  3
  4
  5  END;
  6  /

SQL>

Related Topic