In this blog post, let’s learn about the error message “4111 The query contains a SEQUENCE BY clause but no sequence functions.” when working with HPE NonStop SQL/MX, the reason for the error and the solution to fix this error message.
Error Message
4111 The query contains a SEQUENCE BY clause but no sequence functions.
Reason for the Error
You specified a query that contained a SEQUENCE BY clause but no sequence functions, which is not supported. The purpose of the SEQUENCE BY clause is to specify an ordering for computing one or more sequence functions. Without sequence functions, the SEQUENCE BY clause has no effect.
Solution
Correct the syntax by adding a sequence function to the query or by using an ORDER BY (if you intend to order the result set.) For example:
>>select a from T1 sequence by a;
*** ERROR[4111] The query contains a SEQUENCE BY clause but no sequence functions.
*** ERROR[8822] Unable to prepare the statement.
Correct the syntax with one of the following:
>>select a, runningavg(c) from T1 sequence by a;
>>select a from T1 order by a