Window function requires ORDER BY

Item Value
SQLCODE -965
Constant SQLE_ORDERBY_REQUIRED
SQLSTATE 42WA9
Sybase error code 13525
ODBC 2 State ERROR
ODBC 3 State ERROR

Probable cause 

Rank functions and window functions that use the RANGE keyword must specify an ORDER BY.