100%(1)1 out of 1 people found this document helpful
This preview shows page 213 - 216 out of 380 pages.
Correlated SubqueriesThe subquery references a column from a table in the parent query.SELECT column1, column2, ...FROM table1WHERE column1operator (SELECT column1, column2FROM table2WHERE expr1= .expr2);outerouterCorrelated Subqueries (continued)A correlated subquery is one way of reading every row in a table and comparing values in each row against related data. It is used whenever a subquery must return a different result or set of results for each candidate row considered by the main query. That is, you use a correlated subquery to answer a multipart question whose answer depends on the value in each row processed by the parent statement.The Oracle server performs a correlated subquery when the subquery references a column from a table in the parent query.Note:You can use the ANYand ALLoperators in a correlated subquery.