rspec/rules/S4054/comments-and-links.adoc

29 lines
1.5 KiB
Plaintext

=== on 26 Jun 2017, 14:29:34 Pierre-Yves Nicolas wrote:
"TOP" is specific to TSQL.
The DB2 equivalent syntax is probably https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/perf/src/tpc/db2z_fetchfirstnrows.html[``++FETCH FIRST n ROWS ONLY++``].
For PLSQL, selecting only a given number of rows is usually done with ``++ROWNUM++``. However, http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html[``++ROWNUM++`` is very different from ``++TOP++``]. We may think of a different rule for PLSQL where we detect that "where rownum < x" and "order by" are used in the same query instead of "order by" being used in a subquery.
=== on 26 Jun 2017, 23:17:00 Ann Campbell wrote:
Thanks [~pierre-yves.nicolas]. I thought I remembered using ``++top++`` with Oracle, but that was admittedly more than 10 years ago. I've updated the targeted languages.
=== on 26 Jun 2017, 23:21:20 Ann Campbell wrote:
Re-targeting COBOL for this syntax: ``++FETCH FIRST n ROWS ONLY++``
=== on 27 Jun 2017, 09:38:19 Pierre-Yves Nicolas wrote:
\[~ann.campbell.2] Do you want to create another rule for PLSQL to catch the error mentioned on http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html[Oracle "Ask Tom"]?
____That is why a query in the following form is almost certainly an error:
----
select *
from emp
where ROWNUM <= 5
order by sal desc;{code}{quote}
----
=== on 27 Jun 2017, 16:12:40 Ann Campbell wrote:
To close the thread: RSPEC-4062