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

Term: ON

Definition:
Oracle provides the ON clause to specify join conditions in SELECT statements joining multiple tables together. It is independent of column names and data types. Like the USING clause, the ON clause and NATURAL JOIN are mutually exclusive.

In cases where the participating tables are more than two ON clauses, Oracle uses the first ON clause specification to join two tables. It then uses the second ON clause specification to combine the next table with the result of the first join.

The ON keyword is also used in other contexts, such as in the GRANT and INDEX statements.

Notes:
  1. After the keyword ON join condition is written, generally it can contain predicates connected with Boolean AND, OR, and NOT
  2. The order of the tables is not relevant
  3. The use of parentheses are optional in the syntax, but increases readability

Example Syntax:

SELECT
<column list>
FROM TABLE_1
JOIN TABLE_2
ON (join condition)


Example Usage:

The SQL query below shows the employee name and their working department name:

SQL> SELECT    E.ENAME,  D.DNAME
FROM EMPLOYEE E JOIN DEPT D
ON (E.DEPTNO =D.DEPTNO)



Related Links:

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