Returns a TRUE value if two expressions are equal.
Syntax
expression { EQ | = } expression
|
-
expression
- A constant, field name, variable name, or expression. The expressions
on either side of the EQ or = must be of the same data type, although one
might be an integer and the other a decimal.
Example
This
procedure prompts for the initials of a sales rep. The FOR EACH
block reads all the order records for that sales rep. The DISPLAY
statement displays information from each of the retrieved records.
r-eq.p
PROMPT-FOR Order.SalesRep WITH SIDE-LABELS CENTERED.
FOR EACH Order NO-LOCK WHERE Order.SalesRep EQ INPUT Order.SalesRep:
DISPLAY Order.OrderNum Order.CustNum Order.OrderDate Order.PromiseDate
Order.ShipDate
WITH CENTERED.
END.
|
Notes
- By
default, the AVM 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 the
AVM accesses during the session, except when the AVM uses or modifies
pre-existing indexes. If you do not specify a collation with the -cpcoll startup
parameter, the AVM 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, the AVM uses the collation rules with
the default name "basic" (which might or might
not exist in the convmap.cp file).
- You can compare character strings with EQ. Most character comparisons
are case insensitive in ABL. That is, upper-case and lower-case
characters have the same sort value. 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.
- If one of the expressions has an Unknown value (?) and
the other does not, the result is FALSE. If both have the Unknown value (?),
the result is TRUE. However, for SQL, if the value of either or
both expressions is the Unknown value (?), then the result
is the Unknown value (?).
- The equal comparison ignores trailing blanks. Thus, "abc" is
equal to "abc ". However, leading and embedded blanks are
treated as characters and " abc" is not equal to "abc".
- You cannot compare data of different DATE, DATETIME, and DATETIME-TZ
data types to each other using EQ. You must first convert different
date and datetime data types to the same data type before doing a
comparison between them.
- You can use EQ to compare one BLOB field to another. The AVM performs
a byte-by-byte comparison.
- You can use EQ 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 the AVM raises a run-time
error.
- You can use EQ to compare a CLOB field to another CLOB field.
- You can use EQ to compare two enums, including both ABL and .NET enums, as long as they
are the same enum type. EQ compares the underlying numerical values of the
enumerators.