rspec/rules/S2457/plsql/rule.adoc

42 lines
975 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
A ``++CROSS JOIN++`` query will return all records where each row from the first table is combined with each row from the second table. This means that such a query returns the Cartesian product of the sets of rows from the joined tables, which is why it is also know as "Cartesian product query".
Such a query can return a huge amount of data, and therefore should be used only with great caution and only when really needed.
=== 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
-- Standard ANSI syntax
SELECT *
INTO employeeArray
FROM employee CROSS JOIN department; -- Noncompliant; explicit cross join
END;
/
BEGIN
-- Old syntax
SELECT *
INTO employeeArray
FROM employee, department; -- Noncompliant; also a cross join
END;
/
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this "CROSS JOIN" query
endif::env-github,rspecator-view[]