are they basically the same thing? I read up they were integrated from different platforms for flexibility hence the similarity..
In any case I've ran a few queries and have gotten the same output my latest (this was actually from an article):
SELECT department_name, employee_id, employee_name
FROM departments d
cross APPLY (SELECT employee_id, employee_name
FROM employees1 e
where e.department_id = d.department_id)
ORDER BY 1, 2, 3;
SELECT department_name, employee_name
FROM departments d,
LATERAL (SELECT employee_name
FROM employees1 e
WHERE e.department_id = d.department_id)
with that being said here's the oradoc explanation:
http://docs.oracle.com/database/121/SQLRF/statements_10002.htm#SQLRF01702
cross_outer_apply_clause
This clause allows you to perform a variation of an ANSI CROSS
JOIN
or an ANSILEFT
OUTER
JOIN
with left correlation support. You can specify atable_reference
or collection_expression
to the right of the APPLY
keyword. The table_reference
can be a table, inline view, or TABLE
collection expression. The collection_expression
can be a subquery, a column, a function, or a collection constructor. Regardless of its form, it must return a collection value—that is, a value whose type is nested table or varray. Thetable_reference
or collection_expression
can reference columns of tables defined in the FROM
clause to the left of the APPLY
keyword. This is called left correlation.
LATERAL Specify LATERAL
to designate subquery
as a lateral inline view. Within a lateral inline view, you can specify tables that appear to the left of the lateral inline view in the FROM
clause of a query. You can specify this left correlation anywhere within subquery
(such as the SELECT
, FROM
, and WHERE
clauses) and at any nesting level.
Is there something distinct that differentiates cross apply and lateral?