rspec/rules/S2529/plsql/rule.adoc

47 lines
1.0 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
Developers should use the ``++FROM ... OUTER JOIN++`` syntax rather than the Oracle join operator (``+``). The reason is that outer join queries that use ``+`` are subject to several restrictions which do not apply to the ``++FROM ... OUTER JOIN++`` syntax. For instance, a ``++WHERE++`` condition containing the ``+`` operator cannot be combined with another condition using the ``++OR++`` logical operator.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,sql]
2021-04-28 16:49:39 +02:00
----
BEGIN
-- Noncompliant
SELECT *
INTO employeesArray
FROM employee, department
WHERE employee.DepartmentID = department.ID(+);
END;
/
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,sql]
2021-04-28 16:49:39 +02:00
----
BEGIN
-- Compliant
SELECT *
INTO employeesArray
FROM employee LEFT OUTER JOIN department
ON employee.DepartmentID = department.ID;
END;
/
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Refactor this SQL to use standard join syntax.
endif::env-github,rspecator-view[]