![]() |
SQL-J Language Reference
|
Reference Manual |
ORDER BY clauseThe ORDER BY clause is an optional element of a SELECT statement. An ORDER BY clause allows you to specify the order in which rows appear in the ResultSet. Syntax
ORDER BY { ColumnName | ColumnPosition } ColumnPosition is an integer that refers to the number of the column in the SelectItem in the underlying Query of the SELECT statement (numbering starts at 1). (In other words, if you want to order by a column, that column must be in the select list.) ColumnName refers to the names visible from the SelectItems in the underlying query of the SELECT statement. (In other words, if you want to order by a column, that column must be in the select list.) ASC specifies that the results should be returned in ascending order; DESC specifies that the results should be returned in descending order. If the order is not specified, ASC is the default. An ORDER BY clause prevents a SELECT statement from being an updatable cursor. (For more information, see Requirements for Updatable Cursors.) For ORDER BY, NULLs sort low. For example, if an INTEGER column contains integers, NULL is considered less than 1 for purposes of sorting. You cannot ORDER BY a Java data type unless the data type is orderable (see Orderable Java Data Types). NOTE: To order text data according to a database locale, use international string data types (NCHAR, NVARCHAR, and LONG NVARCHAR). CAST string constants to such types if necessary. Example
SELECT hotel_name, normal_rate
SELECT city.getName(), city.getDisplayCountry() AS COUNTRY
-- order by an Orderable Java data type
-- order string constants according to a database's locale: |
|
![]() Cloudscape Version 3.6 For information about Cloudscape technical support, go to: www.cloudscape.com/support/.Copyright © 1998, 1999, 2000 Informix Software, Inc. All rights reserved. |