This topic describes SELECT AS operations, contains lists of Analytics functions (aggregation, numeric and time/date), and describes the COALESCE expression.

Having created a set of aggregates using a GROUP BY operation, it is typical for Analytics queries to compute one or more derived analytics in each resulting bucket. This is accomplished using SELECT AS operations and Analytics expressions.

Each aggregation operation can declare an arbitrary set of named expressions, sometimes referred to as derived properties, using SELECT AS syntax. These expressions represent aggregate analytic functions that are computed for each aggregated Oracle Commerce Guide Search record in the statement result. Expressions can make use of a broad array of operators, which are described in the following section.

Analytics supports the following numeric functions:

Function

Description

addition

The addition operator (+).

subtraction

The subtraction operator (-).

multiplication

The multiplication operator (*).

division

The division operator (/).

ABS

Returns the absolute value of n. If n is 0 or a positive integer, returns n; otherwise, n is multiplied by -1.

CEIL

Returns the smallest integer value not less than n.

EXP

Exponentiation, where the base is e. Returns the value of e (the base of natural logarithms) raised to the power of n.

FLOOR

Returns the largest integer value not greater than n.

LN

Natural logarithm. Computes the logarithm of its single argument, the base of which is e.

LOG

Logarithm. log(n, m) takes two arguments, where n is the base, and m is the value you are taking the logarithm of.

MOD

Modulo. Returns the remainder of n divided by m. Analytics uses the fmod floating point remainder, as defined in the C/POSIX standard.

ROUND

Returns a number rounded to the specified decimal place.

The unary version drops the decimal (non-integral) portion of the input.

The binary version allows you to set the number of spaces at which the number is rounded:

SIGN

Returns the sign of the argument as -1, 0, or 1, depending on whether n is negative, zero, or positive.

SQRT

Returns the nonnegative square root of n.

TRUNC

Returns the number n, truncated to m decimals. If m is 0, the result has no decimal point or fractional part. The unary version drops the decimal (non-integral) portion of the input, while the binary version allows you to set the number of spaces at which the number is truncated.

SIN

The sine of n, where the angle of n is in radians.

COS

The cosine of n, where the angle of n is in radians.

TAN

The tangent of n, where the angle of n is in radians.

POWER

Returns the value of n raised to the power of m.

TO_DURATION

Casts an integer into a number of milliseconds so that it can be used as a duration. When the unary version of TO_DURATION is given a value of type double, it removes the decimal portion and converts the integer portion to a duration.


Copyright © Legal Notices