Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## NE or <> operator

> Compares two expressions and returns a TRUE value if they are not equal.

> #### Syntax

>     expression { NE | <> } expression

> ``expression``

> A constant, field name, variable name, or expression. The expressions on either side of the NE or must be of the same data type.

> Example

> This procedure displays information for all items that appear in the catalog. (The cat-page field is not equal to the Unknown value (`?`) or 0).

> r-ne.p
>     FOR EACH item WHERE cat-page <> ? AND cat-page <> 0:
>          DISPLAY item-num item-name cat-page
>            WITH TITLE "Catalog Items" USE-TEXT.
>     END.

> #### Notes

> - By default, Progress uses the collation rules you specify to compare characters and sort records. The collation rules specified with the Collation Table (`-cpcoll`) startup parameter take precedence over a collation specified for any database Progress accesses during the session, except when Progress uses or modifies pre-existing indexes. If you do not specify a collation with the -`cpcoll` startup parameter, Progress uses the language collation rules defined for the first database on the command line. If you do not specify a database on the command line, Progress uses the collation rules with the default name "`basic`" (which might or might not exist in the `convmap.cp` file).

> - If one of the expressions has the Unknown value (`?`) and the other does not, the result is TRUE. If both have the Unknown value (`?`), the result is FALSE. For SQL, however, if one or both expressions have the Unknown value (`?`), then the result is the Unknown value (`?`).

> - You can compare character strings with NE. Most character comparisons are case insensitive in Progress. That is, all characters are converted to uppercase prior to comparisons. However, it is possible to define fields and variables as case sensitive (although it is not advised, unless strict ANSI SQL adherence is required). If either `expression` is a field or variable defined as case sensitive, the comparison is case sensitive and “Smith” does not equal “smith”.

> - Characters are converted to their sort code values for comparison. Using the default case-sensitive collation table, all uppercase letters sort before all lowercase letters (for example, a is greater than Z, but less than b.) Note also that in character code uppercase A is less than [ , \ , ^ , _, and ’ , but lowercase a is greater than these.

> - You can use NE to compare DATE, DATETIME, and DATETIME-TZ data. The data type that contains less information (that is, a DATE value contains less information than a DATETIME value, and a DATETIME value contains less information than a DATETIME-TZ value) is converted to the data type with more information by setting the time value to midnight, and the time zone value to the session's time zone (when the data type does not contain the time or time zone). Comparisons with DATETIME-TZ data are based on Coordinated Universal Time (UTC) date and time.

> - You can use NE to compare one BLOB field to another. Progress performs a byte-by-byte comparison.

> - You can use NE to compare a LONGCHAR variable to another LONGCHAR or CHARACTER variable. The variable values are converted to `-cpinternal` for comparison and must convert without error, or Progress raises a run-time error.

> - You can use NE to compare a CLOB field only to the Unknown value (`?`).

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095