++1 or -444,
the standard numeric conversion is applied to the operand. The following
table shows the data type for unary expressions:
|
Expression Type
|
Expression Data Type
|
|---|---|
|
Unary plus
|
same as the operand
or DOUBLE for converted operands
|
|
Unary minus
|
same as the operand
or DOUBLE for converted operands
|
|
Unary not
|
INTEGER
|
(a <> start) OR (f = finish), the
standard numeric conversion is applied to each operand. The following
table shows the precedence that is used to determine the data type
of the expression, where 1 is the highest precedence and 3 is the
lowest. The data type of the expression is the data type of the operand
that has the higher precedence.
|
Precedence
|
Data Type of Either
Operand
|
Expression Data Type
|
|---|---|---|
|
1
|
DOUBLE
|
DOUBLE
|
|
2
|
BIGINT
|
BIGINT
|
|
3
|
all other numeric data
types
|
INTEGER
|
a<>b or a
+ (b * c), the standard numeric conversion is applied
to each operand.
|
Precedence
|
Data Type of Either
Operand
|
Expression Data Type
|
|---|---|---|
|
1
|
DOUBLE
|
DOUBLE
|
|
2
|
BIGINT
|
BIGINT
|
|
3
|
all other numeric data
types
|
INTEGER
|
|
Operator
|
Operator Data Type
|
Expression Data Type
|
|---|---|---|
|
**
|
all numeric data types
|
DOUBLE
|
x <= y or i
> 4, the standard conversion that is applied depends
on the operand data types. The data type of the expression is always
BOOLEAN, as shown in the following tables.
|
Order of Data Type Resolution
|
Data Type of Either
Operand
|
Standard Conversion
|
Expression Data Type
|
|---|---|---|---|
|
1
|
any numeric data type
|
numeric
|
BOOLEAN
|
|
2
|
CHAR/NCHAR
|
character
|
BOOLEAN
|
|
3
|
DATE, TIME, TIMESTAMP
|
none, data types must
match
|
BOOLEAN
|
|
4
|
all other data types
|
none, error returned
|
not applicable
|
|
Operand
|
Operand Conversion
|
Expression Data Type
|
|---|---|---|
|
all
|
standard numeric or
standard character
|
BOOLEAN
|
a || b or x
!! y, the standard character conversion is applied to
each operand. The following table shows the precedence used to determine
the data type of the expression, where 1 is the highest precedence
and 2 is the lowest. The data type of the expression is the data type
of the operand that has the higher precedence.
|
Precedence
|
Data Type of Either
Operand
|
Expression Data Type
|
|---|---|---|
|
1
|
if either is type NCHAR
|
NCHAR
|
|
2
|
CHAR
|
CHAR
|