== Why is this an issue?

Using ``++FETCH FIRST n ROWS ONLY++`` in a ``++SELECT++`` without ordering the results from which the "n first" results are chosen will return a seemingly random set of rows, and is surely a mistake.

=== Noncompliant code example

[source,cobol]
----
SELECT fname, lname, city
  FROM people
  WHERE city IS NOT NULL
  FETCH FIRST 10 ROWS ONLY; -- Noncompliant selects 10 random rows
----

=== Compliant solution

[source,cobol]
----
SELECT fname, lname, city
  FROM people
  WHERE city IS NOT NULL
  ORDER BY birthdate DESC
  FETCH FIRST 10 ROWS ONLY;
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

 Add an "ORDER BY" clause; without it, "FETCH FIRST" will return rows selected at random.


=== Highlighting

FETCH FIRST n ROWS ONLY


'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
