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;
/
Using Comparison Operators
0 comments:
Post a Comment