In Oracle PL/SQL term OR refers to a logical operator. It operates on (tests) two operands and returns a boolean output of either TRUE or FALSE. It returns TRUE if either of the participating terms or tests is TRUE. It returns FALSE only and only if both the terms are FALSE. It is used to append multiple conditions in a WHERE clause.
The OR operator checks the value of the two operands and returns the result. For example, if you are testing two temperature values and want to send an alert if either of them is over 50 degrees. The English representation of the OR test for this would be, "If temperature A is more than 50 OR If temperature B is more than 50, send an alert."
Operand 1 OR Operand 2
The SQL below returns the employees whose JOB ID is either MGR or DEV.
SELECT ENAME, DEPTNO, SALARY
WHERE JOB_ID = 'MGR'
OR JOB_ID = 'DEV'
In PL/SQL the OR test is used as follows:
IF (A > B) OR (A < C) THEN
Related Code Snippets:
- Oracle with PHP - The following example demonstrates how data can be SELECTed and manipulated via ...