Start of change

-20211   THE SPECIFICATION ORDER BY OR FETCH FIRST N ROWS ONLY IS INVALID

Explanation

An ORDER BY or FETCH FIRST n ROWS ONLY clause is not allowed:

  • In the outer fullselect of a view definition
  • In a subselect that is not the outermost fullselect
  • In the outer fullselect in the RETURN statement of an SQL table function

System action

The statement cannot be processed.

Programmer response

Correct the failing statement. If the failing statement is CREATE VIEW, specify the invalid clause in SQL statements that refer to the view instead.

SQLSTATE

428FJ

End of change