In the following example, I pass tbA.ID to tbC query. In this case, I used OUTER APPLY operator of SqlServer.
SELECT
...
FROM (SELECT ID FROM TableA ...) tbA
OUTER APPLY (SELECT ... FROM TableB tbB WHERE tbA.ID = tbB.ID) tbC
...
In Oracle, we don't have the OUTER APPLY operator. So, how can I pass a value (tbA.ID) from the left side query to the right side query (tbC) of the join without modifying the structure of my query?
Is there any alternative for OUTER APPLY in Oracle?
SQL Servers outer apply
is similar to the SQL Standards lateral
. Oracle supports lateral
since 12c(*).
Instead of outer apply
you would use left join lateral
in standard SQL or cross join lateral
if you want to omit the ON
/USING
clauses.
Footnote:
(*) before version 12c, Oracle "unsupported" lateral
when enabling a trace event. See https://jonathanlewis.wordpress.com/2011/01/31/ansi-outer/