Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle PL/SQL OR Operator      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: OR

Definition:
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."

Example Syntax:

Operand 1 OR Operand 2


Example Usage:

In SQL,

The SQL below returns the employees whose JOB ID is either MGR or DEV.

SELECT ENAME, DEPTNO, SALARY
FROM EMPLOYEE
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
...
...
END IF;



Related Links:

Related Code Snippets:
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 177 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?