1 – arithmetic-expr
{ + }
{ - }
value-expr { * } value-expr
{ / }
An arithmetic expression combines value expressions and
arithmetic operators. When you use an arithmetic expression in a
value expression, the product using the CDO expression calculates
the value associated with the expression and uses that value when
executing the statement. Therefore, an arithmetic expression must
be reducible to a value.
The value expression, value-expr, is a symbol or a string of
symbols used to calculate a value.
2 – builtin-expr
{ NULL }
{ [ ] }
{ [ [ BOTH ] ] }
{ TRIM ( [ [ LEADING ] CHARACATER value-expr FROM ] value-expr ) }
{ [ [ TRAILING ] ] }
{ [ ] }
{ POSITION (value-expr IN value-expr FROM value-expr ) }
{ USER }
{ CURRENT_USER }
{ CURRENT_DATE }
{ CURRENT_TIME (scale) }
{ CURRENT_TIMESTAMP (scale) }
{ CHARACTER_LENGTH (value-expr) }
{ CHAR_LENGTH (value-expr) }
{ OCTET_LENGTH (value-expr) }
{ UPPER (value-expr) }
{ LOWER (value-expr) }
{ SESSION_USER }
{ SUBSTRING [_OCTETS] (value-expr FROM value-expr FOR value-expr) }
{ SUBSTRING_CHARACTERS (value-expr FROM value-expr FOR value-expr) }
{ SYSTEM_USER }
{ cast-builtin-expr }
{ { YEAR } }
{ { MONTH } }
{ { DAY } }
{ { HOUR } }
{ EXTRACT ( { MINUTE } FROM value-expr) }
{ { SECOND } }
{ { WEEKDAY } }
{ { JULIAN } }
{ TRANSLATE (value-expr USING character-set) }
Calculate values based on specified value expressions. See the
Descriptions subtopic for Built-in Function descriptions.
See the Oracle Rdb7 SQL Reference Manual for the character set
types.
3 – cast-builtin-expr
CAST (value-expr AS
{ }
{FIELD field-name }}
{DATATYPE }}
{{ }}
{{TEXT [CHARACTER_SET IS name] [SIZE IS digits] [CHARACTERS] }}
{{ [OCTETS ] }}
{{ }}
{{VARYING STRING [CHARACTER_SET IS name [SIZE IS digits] [CHARACTERS]}}
{{ [OCTETS ]}}
{{ }}
{{DATE [VMS ] }}
{{ [ANSI] }}
{{ }} )
{{TIME [SCALE scale-value] }}
{{TIMESTAMP [SCALE scale-value] }}
{{interval-builtin-expr }}
{{F_FLOATING }}
{{G_FLOATING }}
{{ }}
{{ {BYTE } }}
{{ {WORD } }}
{{[SIGNED] {LONGWORD} [SCALE scale-value] }}
{{ {QUADWORD} }}
{ }
interval-builtin-expr
{YEAR [SIZE IS digits] [TO MONTH] }
{MONTH [SIZE IS digits] }
{ }
{ [ ]}
{ [ { HOUR }]}
{DAY [SIZE IS digits] [ TO { MINUTE }]}
{ [ { SECOND [SCALE scale-value] }]}
{ [ ]}
{ }
INTERVAL{ [ ] }
{ [ {MINUTE }] }
{HOUR [SIZE IS digits] [ TO {SECOND [SCALE scale-value] }] }
{ [ ] }
{ }
{MINUTE [SIZE IS digits] [TO SECOND [SCALE scale-value] ] }
{SECOND [SIZE IS digits] [SCALE scale-value] }
{ }
Converts a value expression to another data type.
RESTRICTION
The CAST builtin expression requires a space between the
letter T in CAST and the open parenthesis character of the
value expression; otherwise, a syntax error occurs.
4 – case-expr
CASE value-expr { WHEN value-expr THEN value-expr } ...
[ ELSE value-expr ] END
Matches two value expressions for equality. This clause is
identical to the SQL SIMPLE CASE expression.
5 – char-string-literal
Specifies a string of printable characters. See
character_string_literals help topic for more information.
6 – concatenated-expr
{ | }
value-expr { ^ } value-expr ...
Combines two value expressions by joining the second expression
to the end of the first expression.
You can combine value expressions of any kind, including numeric
expressions, string expressions, and literals.
The vertical bar (|) specifies a value through combining one or
more value expressions. The circumflex character (^) specifies a
value through combining one or more value expressions using SQL
concatenation rules.
7 – external-literal
EXTERNAL quoted-string
Specifies the name of an external literal. Defines the equivalent
of the COBOL initial value (VALUE IS EXTERNAL clause) and level
88 condition values (VALUES ARE EXTERNAL clause).
8 – field-or-record-expr
{ }
{ dir-name }
{ { name IN } ... context-var }
{ }
Specifies the name of a field or a record in a database by
directory name, or by field or record name and context variable.
A context variable is a temporary name you associate with a
record. You define a context variable in a record selection
expression (RSE). You specify a context variable only when you
use the name IN parameter of the field or record expression
syntax.
For example, once you define E as the context variable for the
EMPLOYEES relation, LAST_NAME IN E is a value expression that
refers to a value from the LAST_NAME field of EMPLOYEES. Use name
IN only in an expression with a context variable.
9 – first-from-expr
FIRST value-expr FROM rse
Specifies a value by forming a record stream (as indicated by a
record selection expression). If at least one record matches the
RSE, the values stored in the first record of the record stream
are used to evaluate the value expression.
The FIRST FROM expression can perform the equivalent of a table
lookup when you are sure that the value you want to find in a
relation is unique.
The value expression, value-expr, is a symbol or a string of
symbols used to calculate a value. The rse parameter specifies a
clause that products use at run time to include specific records
for processing.
10 – numeric-literal
Specifies a value that can be expressed as a decimal number. See
numeric_literals help topic for more information.
11 – statistical-expr
{ }
{ { MAX } }
{ { MIN } }
{ { TOTAL } value-expr } OF rse
{ { AVERAGE } }
{ }
{ COUNT }
{ }
Specifies a value by forming a record stream (as indicated
by a record selection expression), and evaluating its value
expression against every record in the record stream. Statistical
expressions are sometimes called aggregate expressions because
they calculate a single value for a collection of records. When
you use a statistical expression (except for COUNT), you specify
a value expression and an RSE. A layered product evaluates the
value expression for each record in the record stream formed by
the RSE. Then the product calculates a single value based on the
results of the first step.
The COUNT expression differs from the other statistical operators
because it operates on the record stream defined by the RSE,
rather than on values in that record stream. It returns the
number of records in the record stream. In the following
expression, the number of employees working in New Hampshire
is returned.
COUNT OF E IN EMPLOYEES WITH STATE IN E = "NH"