20
OBIEE FUNCTIONS EXPRESSIONS Case (Switch) Syntax CASE expr1 WHEN expr2 THEN expr3 ELSE expr4 END Description This form of the Case statement is also referred to as the CASE (Lookup) form. The value of expression1 is examined, then the WHEN expressions. If expression1 matches any WHEN expression, it assigns the value in the corresponding THEN expression. If none of the WHEN expressions match, it assigns the default value specified in the ELSE expression. If no ELSE expression is specified, the system will automatically add an ELSE NULL. Case (If) Syntax CASE WHEN request_condition1 THEN expr1 ELSE expr2 END Description This form of the Case statement evaluates each WHEN condition and if satisfied, assigns the value in the corresponding THEN expression. If none of the WHEN conditions are satisfied, it assigns the default value specified in the ELSE expression. If no ELSE expression is specified, the system will automatically add an ELSE NULL. SYSTEM USER() Description Returns the user name for the Oracle BI Repository to which you are logged on. SelectedDatabaseSyntax DATABASE() Description Returns the name of the Oracle BI subject area to which you are logged on. CONVERTIONS Cast Syntax CAST(expr AS type)

Obiee Functions

Embed Size (px)

Citation preview

Page 1: Obiee Functions

OBIEE FUNCTIONS

EXPRESSIONS

Case (Switch)

Syntax

CASE expr1 WHEN expr2 THEN expr3 ELSE expr4 END

Description This form of the Case statement is also referred to as the CASE

(Lookup) form. The value of expression1 is examined, then the WHEN expressions.

If expression1 matches any WHEN expression, it assigns the value in the

corresponding THEN expression. If none of the WHEN expressions match, it

assigns the default value specified in the ELSE expression. If no ELSE expression is

specified, the system will automatically add an ELSE NULL.

Case (If)

Syntax CASE WHEN request_condition1 THEN expr1 ELSE expr2 END

Description This form of the Case statement evaluates each WHEN condition and

if satisfied, assigns the value in the corresponding THEN expression. If none of the

WHEN conditions are satisfied, it assigns the default value specified in the ELSE

expression. If no ELSE expression is specified, the system will automatically add

an ELSE NULL.

SYSTEM

USER()

Description

Returns the user name for the Oracle BI Repository to which you are logged on.

SelectedDatabaseSyntax

DATABASE()

Description

Returns the name of the Oracle BI subject area to which you are logged on.

CONVERTIONS

Cast

Syntax

CAST(expr AS type)

Page 2: Obiee Functions

Description

Changes the data type of a value or a null value to another data type.

IfNull

Syntax

IFNULL(expr, value)

Description

Tests if an expression evaluates to a null value, and if it does, assigns the

specified value to the expression.

ValueOf

Syntax

VALUEOF(expr)

Description

Use the VALUEOF function in a filter to reference the value of an Oracle BI

repository variable.

AGGREGATE

Avg

Syntax

Avg(expr)

Description

Calculates the average (mean) value of an expression in a result set.

AvgDistinct

Syntax

Avg(DISTINCT expr)

Description

Calculates the average (mean) of all distinct values of an expression.

BottomN

Syntax

BottomN(expr, integer)

Page 3: Obiee Functions

Description

Ranks the lowest n values of the expression argument from 1 to n, 1

corresponding to the lowest numerical value.

Count

Syntax

COUNT(expr)

Description

Calculates the number of rows having a non-null value for the expression.

CountDistinct

Syntax

COUNT(DISTINCT expr)

Description

Adds distinct processing to the Count function.

Count*

Syntax

COUNT(*)

Description

Counts the number of rows.

Mavg

Syntax

MAVG(expr, integer)

Description

Calculates a moving average (mean) for the last n rows of data, inclusive of the

current row.

Max

Syntax

MAX(expr)

Description

Page 4: Obiee Functions

Calculates the maximum value (highest numeric value) of the rows satisfying the

numeric expression argument.

Median

Syntax

MEDIAN(expr)

Description

Calculates the median (middle) value of the rows satisfying the numeric

expression argument.

NTile

Syntax NTILE(expr, numTiles)

Description Determines the rank of a value in terms of a user-specified range. It

returns integers to represent any range of ranks. NTile with numTiles=100 returns

what is commonly called the "percentile" (with numbers ranging from 1 to 100,

with 100 representing the high end of the sort).

Min

Syntax

MIN(expr)

Description

Calculates the minimum value (lowest numeric value) of the rows satisfying the

numeric expression argument.

Percentile

Syntax

PERCENTILE(expr)

Description

Calculates a percentile rank for each value satisfying the numeric expression

argument. The percentile rank ranges are between 0 (0th percentile) to 1 (100th

percentile).

Rank

Syntax

RANK(expr)

Description

Page 5: Obiee Functions

Calculates the rank for each value satisfying the numeric expression argument.

The highest number is assigned a rank of 1, and each successive rank is assigned

the next consecutive integer (2, 3, 4,...). If certain values are equal, they are

assigned the same rank (for example, 1, 1, 1, 4, 5, 5, 7...).

StdDev

Syntax

STDDEV(expr)

Description

Returns the standard deviation for a set of values.

StdDev_Pop

Syntax

STDDEV_POP(expr)

Description

Returns the standard deviation for a set of values using the computational formula

for population variance and standard deviation.

Sum

Syntax

SUM(expr)

Description

Calculates the sum obtained by adding up all values satisfying the numeric

expression argument.

SumDistinct

Syntax

Sum(DISTINCT expr)

Description

Calculates the sum obtained by adding all of the distinct values satisfying the

numeric expression argument.

TopN

Syntax

TOPN(expr, integer)

Page 6: Obiee Functions

Description

Ranks the highest n values of the expression argument from 1 to n, 1

corresponding to the highest numerical value.

RUNNING AGGREGATE

MAVG

Syntax

MAVG (expr, integer)

Description

Calculates a moving average (mean) for the last n rows of data in the result set,

inclusive of the current row.

MSUM

Syntax

MSUM (expr, integer)

Description

This function calculates a moving sum for the last n rows of data, inclusive of the

current row.

RSUM

Syntax

RSUM(expr)

Description

This function calculates a running sum based on records encountered so far.

RCOUNT

Syntax

RCOUNT(expr)

Description

This function takes a set of records as input and counts the number of records

encountered so far.

RMAX

Syntax

Page 7: Obiee Functions

RMAX(expr)

Description

This function takes a set of records as input and shows the maximum value based

on records encountered so far.

RMIN

Syntax

RMIN(expr)

Description

This function takes a set of records as input and shows the minimum value based

on records encountered so far.

STRING

ASCII

Syntax

ASCII(expr)

Description

Converts a single character string to its corresponding ASCII code, between 0 and

255.

Bit_Length

Syntax

BIT_LENGTH(expr)

Description

Returns the length, in bits, of a specified string. Each Unicode character is 2 bytes

in length, which is equal to 16 bits.

Char

Syntax

CHAR(expr)

Description

Converts a numerical value between 0 and 255 to the character value

corresponding to the ASCII code.

Page 8: Obiee Functions

Char_Length

Syntax

CHAR_LENGTH(expr)

Description

Returns the length, in number of characters, of a specified string.

Concat

Syntax

CONCAT(expr1, expr2)

Description

Concatenates two character strings.

Insert

Syntax

INSERT(expr1, integer1, integer2, expr2)

Description

Inserts a specified character string into a specified location in another character

string.

Left

Syntax

LEFT(expr, integer)

Description

Returns a specified number of characters from the left of a string.

Length

Syntax

LENGTH(expr)

Description

Returns the length, in number of characters, of a specified string. The length is

returned excluding any trailing blank characters.

Locate

Page 9: Obiee Functions

Syntax

LOCATE(expr1, expr2)

Description

Returns the numerical position of a character string in another character string.

LocateN

Syntax

LOCATEN(expr1, expr2, integer)

Description

Returns the numerical position of a character string in another character string.

This is identical to the Locate function, except that the search begins at the

position specified by an integer argument.

Lower

Syntax

LOWER(expr)

Description

Converts a character string to lowercase.

Octet_Length

Syntax

OCTET_LENGTH(expr)

Description

Returns the number of bits, in base 8 units (number of bytes), of a specified

string.

Position

Syntax

POSITION(expr1 IN expr2)

Description

Returns the numerical position of expr1 in a character expression.

Repeat

Page 10: Obiee Functions

Syntax

REPEAT(expr, integer)

Description

Repeats a specified expression n times.

Replace

Syntax

REPLACE(expr1, expr2, expr3)

Description

Replaces one or more characters from a specified character expression with one or

more other characters.

Right

Syntax

RIGHT(expr, integer)

Description

Returns a specified number of characters from the right of a string.

Space

Syntax

SPACE(expr)

Description

Inserts blank spaces.

Substring

Syntax

SUBSTRING(expr FROM startPos FOR length)

Description

Creates a new string starting from a fixed number of characters into the original

string.

TrimBoth

Syntax

Page 11: Obiee Functions

TRIM(BOTH char FROM expr)

Description

Strips specified leading and trailing characters from a character string.

TrimLeading

Syntax

TRIM(LEADING char FROM expr)

Description

Strips specified leading characters from a character string.

TrimTrailing

Syntax

TRIM(TRAILING char FROM expr)

Description

Strips specified trailing characters from a character string.

Upper

Syntax

UPPER(expr)

Description

Converts a character string to uppercase.

MATHS

Abs

Syntax

ABS(expr)

Description

Calculates the absolute value of a numerical expression.

Acos

Syntax

ACOS(expr)

Page 12: Obiee Functions

Description

Calculates the arc cosine of a numerical expression.

Asin

Syntax

ASIN(expr)

Description

Calculates the arc sine of a numerical expression.

Atan

Syntax

ATAN(expr)

Description

Calculates the arc tangent of a numerical expression.

Atan2

Syntax

ATAN2(expr1, expr2)

Description

Calculates the arc tangent of y/x, where y is the first numerical expression and x

is the second numerical expression.

Ceiling

Syntax

CEILING(expr)

Description

Rounds a noninteger numerical expression to the next highest integer.

Cos

Syntax

COS(expr)

Description

Page 13: Obiee Functions

Calculates the cosine of a numerical expression.

Cot

Syntax

COT(expr)

Description

Calculates the cotangent of a numerical expression.

Degrees

Syntax

DEGREES(expr)

Description

Converts an expression from radians to degrees.

Exp

Syntax

EXP(expr)

Description

Sends the value to the power specified.

Floor

Syntax

FLOOR(expr)

Description

Rounds a noninteger numerical expression to the next lowest integer.

Log

Syntax

LOG(expr)

Description

Calculates the natural logarithm of an expression.

Log10

Page 14: Obiee Functions

Syntax

LOG10(expr)

Description

Calculates the base 10 logarithm of an expression.

Mod

Syntax

MOD(expr1, expr2)

Description

Divides the first numerical expression by the second numerical expression and

returns the nonremainder portion of the quotient.

Pi

Syntax

PI()

Description

Returns the constant value of pi (the circumference of a circle divided by its

diameter).

Power

Syntax

POWER(expr1, expr2)

Description

Takes the first numerical expression and raises it to the power specified in the

second numerical expression.

Radians

Syntax

RADIANS(expr)

Description

Converts an expression from degrees to radians.

Rand

Page 15: Obiee Functions

Syntax

RAND()

Description

Returns a pseudo-random number between 0 and 1.

RandFromSeed

Syntax

RAND(expr)

Description

Returns a pseudo-random number based on a seed value.

Round

Syntax

ROUND(expr, integer)

Description

Rounds a numerical expression to n digits of precision.

Sign

Syntax

SIGN(expr)

Description

Returns: 1 if the numerical expression argument evaluates to a positive number, -

1 if it evaluates to a negative number, or 0 (zero) if it evaluates to zero.

Sin

Syntax

SIN(expr)

Description

Calculates the sine of a numerical expression.

Sqrt

Syntax

Page 16: Obiee Functions

SQRT(expr)

Description

Calculates the square root of the numerical expression argument.

Tan

Syntax

TAN(expr)

Description

Calculates the tangent of a numerical expression.

Truncate

Syntax

TRUNCATE(expr, integer)

Description

Truncates a decimal number to return a specified number of places from the

decimal point.

DATE FUNCTIONS

Current_Date

Syntax

CURRENT_DATE

Description

Returns the current date. The date is determined by the system in which the

Oracle BI Server is running.

Current_Time

Syntax

CURRENT_TIME(expr)

Description

Returns the current time. The time is determined by the system in which the

Oracle BI Server is running.

Current_Time

Page 17: Obiee Functions

StampSyntax

CURRENT_TIMESTAMP(expr)

Description

Returns the current date/timestamp. The timestamp is determined by the system

in which the Oracle BI is running.

Day_of_Quarter

Syntax

DAY_OF_QUARTER(expr)

Description

Returns a number (between 1 and 92) corresponding to the day of the quarter for

the specified date.

DayName

Syntax

DAYNAME(expr)

Description

Returns the name of the day for a specified date.

DayOfMonth

Syntax

DAYOFMONTH(expr)

Description

Returns the number corresponding to the day of the month for a specified date.

DayOfWeek

Syntax

DAYOFWEEK(expr)

Description

Returns a number between 1 and 7 corresponding to the day of the week, Sunday

through Saturday, for a specified date.

DayOfYear

Page 18: Obiee Functions

Syntax

DAYOFYEAR(expr)

Description

Returns the number (between 1 and 366) corresponding to the day of the year for

a specified date.

Hour

Syntax

HOUR(expr)

Description

Returns the number (between 0 and 23) corresponding to the hour for a specified

time.

Minute

Syntax

MINUTE(expr)

Description

Returns the number (between 0 and 59) corresponding to the minute for a

specified time.

Month

Syntax

MONTH(expr)

Description

Returns a number (between 1 and 12) corresponding to the month for a specified

date.

Month_Of_Quarter

Syntax

MONTH_OF_QUARTER(expr)

Description

Returns the number (between 1 and 3) corresponding to the month in the quarter

for a specified date.

Page 19: Obiee Functions

MonthName

Syntax

MONTHNAME(expr)

Description

Returns the name of the month for a specified date.

Now

Syntax

NOW()

Description

Returns the current timestamp. This function is equivalent to the function

Current_TimeStamp.

Quarter_Of_Year

Syntax

QUARTER_OF_YEAR(expr)

Description

Returns the number (between 1 and 4) corresponding to the quarter of the year

for a specified date.

Second

Syntax

SECOND(expr)

Description

Returns the number (between 0 and 59) corresponding to the seconds for a

specified time.

TimestampAdd

Syntax

TIMESTAMPADD(interval, expr, timestamp)

Description

Adds a specified number of intervals to a specified timestamp, and returns a single

timestamp.

Page 20: Obiee Functions

TimestampDiff

Syntax

TIMESTAMPDIFF(interval, expr, timestamp2)

Description

Returns the total number of specified intervals between two timestamps.

Week_Of_Quarter

Syntax

WEEK_OF_QUARTER(expr)

Description

Returns a number (between 1 and 13) corresponding to the week of the quarter

for the specified date.

Week_Of_Year

Syntax

WEEK_OF_YEAR(expr)

Description

Returns a number (between 1 and 53) corresponding to the week of the year for

the specified date.

Year

Syntax

YEAR(expr)

Description

Returns the year for the specified date.