Index | Home | Forums
Oracle PL/SQL Example 2-24 Using Comparison Operators

Example 2-24 Using Comparison Operators

DECLARE
   PROCEDURE assert(assertion VARCHAR2, truth BOOLEAN)
   IS
   BEGIN
      IF truth IS NULL THEN
         DBMS_OUTPUT.PUT_LINE('Assertion ' || assertion || ' is unknown (NULL)');
      ELSIF truth = TRUE THEN
         DBMS_OUTPUT.PUT_LINE('Assertion ' || assertion || ' is TRUE');
      ELSE
         DBMS_OUTPUT.PUT_LINE('Assertion ' || assertion || ' is FALSE');
      END IF;
   END;
BEGIN
   assert('2 + 2 = 4', 2 + 2 = 4);
   assert('10 > 1', 10 > 1);
   assert('10 <= 1', 10 <= 1);
   assert('5 BETWEEN 1 AND 10', 5 BETWEEN 1 AND 10);
   assert('NULL != 0', NULL != 0);
   assert('3 IN (1,3,5)', 3 IN (1,3,5));
   assert('''A'' < ''Z''', 'A' < 'Z');
   assert('''baseball'' LIKE ''%all%''', 'baseball' LIKE '%all%');
   assert('''suit'' || ''case'' = ''suitcase''', 'suit' || 'case' = 'suitcase');
END;
/


This page was generated on/at Feb 23,2008 00:20:12
General comments and questions regarding this document should be sent by email to info@oracleabc.com or post your comments here




Index | Home | Forums
Oracle PL/SQL Example 2-24 Using Comparison Operators

Example 2-24 Using Comparison Operators

DECLARE
   PROCEDURE assert(assertion VARCHAR2, truth BOOLEAN)
   IS
   BEGIN
      IF truth IS NULL THEN
         DBMS_OUTPUT.PUT_LINE('Assertion ' || assertion || ' is unknown (NULL)');
      ELSIF truth = TRUE THEN
         DBMS_OUTPUT.PUT_LINE('Assertion ' || assertion || ' is TRUE');
      ELSE
         DBMS_OUTPUT.PUT_LINE('Assertion ' || assertion || ' is FALSE');
      END IF;
   END;
BEGIN
   assert('2 + 2 = 4', 2 + 2 = 4);
   assert('10 > 1', 10 > 1);
   assert('10 <= 1', 10 <= 1);
   assert('5 BETWEEN 1 AND 10', 5 BETWEEN 1 AND 10);
   assert('NULL != 0', NULL != 0);
   assert('3 IN (1,3,5)', 3 IN (1,3,5));
   assert('''A'' < ''Z''', 'A' < 'Z');
   assert('''baseball'' LIKE ''%all%''', 'baseball' LIKE '%all%');
   assert('''suit'' || ''case'' = ''suitcase''', 'suit' || 'case' = 'suitcase');
END;
/


This page was created by oracleabc.com on Feb 23,2008 00:09:02
General comments and questions regarding this document should be sent by email to info@oracleabc.com or post your comments here