To use IBM Cognos product documentation, you must enable JavaScript in your browser.

Expression Components

To build an expression, choose from the following:

Operators

Operators specify what happens to the values on either side of the operator. Operators are similar to functions, in that they manipulate data items and return a result.

(

Inserts an open parenthesis in your expression.

Syntax
(exp) 

)

Inserts a close parenthesis in your expression.

Syntax
(exp) 

*

Multiplies two numeric values.

Syntax
value1 * value2 

,

Separates expression components.

Syntax
exp(param1, param2) 

/

Divides two numeric values.

Syntax
value1 / value2 

||

Concatenates strings.

Syntax
string1 || string2 

+

Adds two values.

Syntax
value1 + value2 

-

Subtracts two numeric values or negates a numeric value.

Syntax
value1 - value2 
or 
- value 

<

Compares values against a defined value and retrieves the values that are less than the defined value.

Syntax
value1 < value2 

<=

Compares values against a defined value and retrieves the values that are less than or equal to the defined value.

Syntax
value1 <= value2 

<>

Compares values against a defined value and retrieves the values that are not equal to the defined value.

Syntax
value1 <> value2 

=

Compares values against a defined value and retrieves the values that are equal to the defined value.

Syntax
value1 = value2 

>

Compares values against a defined value and retrieves the values that are greater than the defined value.

Syntax
value1 > value2 

->

Separates the components in a literal member expression.

Syntax
[namespace].[dimension].[hierarchy].[level]->[L1] 

>=

Compares values against a defined value and retrieves the values that are greater than or equal to the defined value.

Syntax
value1 >= value2 

and

Returns TRUE if the conditions on both sides of the expression are true.

Syntax
arg1 AND arg2 

auto

Works with summary expressions to define the scope to be adjusted based on the grouping columns in the query. The scope is context dependent.

Syntax
aggregate_function ( expression AUTO ) 

between

Determines if a value falls in a given range.

Syntax
name BETWEEN value1 and value2 

case

Works with When, Then, Else, and End.

Syntax
CASE expression { WHEN expression THEN expression } [
ELSE expression ] END 

contains

Determines if a string contains another string.

Syntax
string1 CONTAINS string2 

currentMeasure

Keyword that can be used as the first argument of member summary functions.

Syntax
aggregate_function( currentMeasure within set expression
) 

default

Works with the LOOKUP construct.

Syntax
lookup(....) in (....) DEFAULT(....) 

distinct

A keyword used in an aggregate expression, to include only distinct occurrences of values. See also the function unique.

Syntax
DISTINCT dataItem 
Example
count ( DISTINCT [OrderDetailQuantity] ) 

Result: 1704

else

Works with the If or Case constructs.

Syntax
IF (condition) THEN .... ELSE (expression) , or CASE
.... ELSE expression END 

end

Works with the Case or When constructs.

Syntax
CASE .... END 

ends with

Determines if a string ends with a given string.

Syntax
string1 ENDS WITH string2 

for

Works with summary expressions to define the scope of the aggregation in the query.

Syntax
aggregate_function ( expression FOR expression { , expression
} ) 

for all

Works with summary expressions to define the scope to be all the specified grouping columns in the query. See also FOR clause.

Syntax
aggregate_function ( expression FOR ALL expression {
, expression } ) 

for any

Works with summary expressions to define the scope to be adjusted based on a subset of the grouping columns in the query. Equivalent to FOR clause.

Syntax
aggregate_function ( expression FOR ANY expression {
, expression } ) 

for report

Works with summary expressions to set the scope to be the whole query. See also FOR clause.

Syntax
aggregate_function ( expression FOR REPORT ) 

if

Works with the Then and Else constructs.

Syntax
IF (condition is true) THEN (action) ELSE (alternate
action) 

in

Determines if a value exists in a given list of values.

Syntax
exp1 IN (exp_list) 

in_range

Determines if an item exists in a given list of constant values or ranges.

Syntax
expression IN_RANGE { constant : constant [ , constant
: constant ] }  
Example 1
[code] IN_RANGE { 5 } 

Result: This is equivalent to [code] = 5

Example 2
[code] IN_RANGE { 5: } 

Result: This is equivalent to [code] >= 5

Example 3
[code] IN_RANGE { :5 } 

Result: This is equivalent to [code] <= 5

Example 4
[code] IN_RANGE { 5:10 } 

Result: This is equivalent to ( [code] >= 5 and [code] <= 10 )

Example 5
[code] IN_RANGE { :5,10,20: } 

Result: This is equivalent to ( [code] <= 5 or [code] = 10 or [code] >= 20 )

is missing

Determines if a value is undefined in the data.

Syntax
value IS MISSING 

is null

Determines if a value is undefined in the data.

Syntax
value IS NULL 

is not missing

Determines if a value is defined in the data.

Syntax
value IS NOT MISSING 

is not null

Determines if a value is defined in the data.

Syntax
value IS NOT NULL 

like

Determines if a string matches the pattern of another string.

Syntax
string1 LIKE string2 

lookup

Finds and replaces data with a value you specify. It is preferable to use the CASE construct.

Syntax
LOOKUP (name) in (value1 --> value2) default (expression) 
Example
lookup([Country]) in ('Canada'-->([List Price] * 0.60),
'Australia'-->([List Price] * 0.80)) default([List Price])  

not

Returns TRUE if the condition is false, otherwise returns FALSE.

Syntax
NOT arg 

or

Returns TRUE if either of the two conditions on both sides of the expression are true.

Syntax
arg1 OR arg2 

prefilter

Performs a summary calculation before applying the summary filter.

Syntax
summary ([expression] PREFILTER) 

rows

Counts the number of rows output by the query. Use with Count().

Syntax
count(ROWS) 

starts with

Determines if a string starts with a given string.

Syntax
string1 STARTS WITH string2 

then

Works with the If or Case constructs.

Syntax
IF (condition) THEN ...., or CASE expression WHEN expression
THEN .... END 

when

Works with the Case construct.

Syntax
CASE [expression] WHEN .... END 

Summaries

This list contains predefined functions that return either a single summary value for a group of related values or a different summary value for each instance of a group of related values.

aggregate

Returns a calculated value using the appropriate aggregation function, based on the aggregation type of the expression.

Syntax
aggregate ( expr [ auto ] ) 
aggregate ( expr for [ all | any ] expr { , expr } ) 
aggregate ( expr for report ) 

average

Returns the average value of selected data items. The keyword distinct is available for backward compatibility of expressions used in previous versions of the product.

Syntax
average ( [ distinct ] expr [ auto ] ) 
average ( [ distinct ] expr for [ all | any ] expr { , expr } ) 
average ( [ distinct ] expr for report ) 
Example
average ( Sales ) 

Result: The average of all Sales values.

count

Returns the number of selected data items excluding NULL values. The keyword distinct is available for backward compatibility of expressions used in previous versions of the product.

Syntax
count ( [ distinct ] expr [ auto ] ) 
count ( [ distinct ] expr for [ all | any ] expr { , expr } ) 
count ( [ distinct ] expr for report ) 
Example
count ( Sales ) 

Result: The total number of entries under Sales.

maximum

Returns the maximum value of selected data items. The keyword distinct is available for backward compatibility of expressions used in previous versions of the product.

Syntax
maximum ( [ distinct ] expr [ auto ] ) 
maximum ( [ distinct ] expr for [ all | any ] expr { , expr } ) 
maximum ( [ distinct ] expr for report ) 
Example
maximum ( Sales ) 

Result: The maximum value of all Sales values.

median

Returns the median value of selected data items.

Syntax
median ( expr [ auto ] ) 
median ( expr for [ all | any ] expr { , expr } ) 
median ( expr for report ) 

minimum

Returns the minimum value of selected data items. The keyword distinct is available for backward compatibility of expressions used in previous versions of the product.

Syntax
minimum ( [ distinct ] expr [ auto ] ) 
minimum ( [ distinct ] expr for [ all | any ] expr { , expr } ) 
minimum ( [ distinct ] expr for report ) 
Example
minimum ( Sales ) 

Result: The minimum value of all Sales values.

moving-average

Returns a moving average by row for a specified set of values of over a specified number of rows. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword distinct is available for backward compatibility of expressions used in previous versions of the product.

Syntax
moving-average ( numeric_expr , numeric_expr  [ at exp
{, expr } ]  [ <for-option> ] [ prefilter ] ) 
moving-average ( [ distinct ] numeric_expr , numeric_expr [ <for-option>
] [ prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto 
Example
moving-average ( Qty, 3 ) 

Result: For each row, this displays the quantity and a moving average of the current row and the preceding two rows.

Qty

------

200

700

400

200

200

500

Moving-Average (Qty, 3)

------------------------------------

200

450

433.3333

433.3333

266.6667

300.0000

moving-total

Returns a moving total by row for a specified set of values over a specified number of rows. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
moving-total ( numeric_expr , numeric_expr  [ at exp
{, expr } ]  [ <for-option> ] [ prefilter ] ) 
moving-total ( [ distinct ] numeric_expr , numeric_expr [ <for-option>
] [ prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto 
Example
moving-total ( Quantity, 3 ) 

Result: For each row, this displays the quantity and a moving total of the current row and the preceding two rows.

Qty

------

200

700

400

200

200

500

Moving-Total (Qty, 3)

--------------------------------

200

900

1300

1300

800

900

percentage

Returns the percent of the total value for selected data items. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
percentage ( numeric_expr  [ at exp {, expr } ]  [ <for-option>
] [ prefilter ] ) 
percentage ( [ distinct ] numeric_expr [ <for-option> ] [ prefilter
] ) 
<for-option> ::= for expr {, expr } | for report | auto 
Example
percentage ( sales 98 ) 

Result: Shows the percentage of the total sales for 1998 that is attributed to each sales representative.

Sales Rep

-----------------

Bill Gibbons

Bjorn Flertjan

Chris Cornel

Sales 98

------------

60646

62523

22396

Percentage

--------------

7.11%

7.35%

2.63%

percentile

Returns a value, on a scale of one hundred, that indicates the percent of a distribution that is equal to or below the selected data items. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
percentile ( numeric_expr  [ at exp {, expr } ] [ <for-option>
] [ prefilter ] ) 
percentile ( [ distinct ] numeric_expr [ <for-option> ] [ prefilter
] ) 
<for-option> ::= for expr {, expr } | for report | auto  
Example
percentile ( Sales 98 ) 

Result: For each row, the percentage of rows that are equal to or less than the quantity value of that row are displayed.

Qty

------

800

700

600

500

400

400

200

200

Percentile (Qty)

-----------------

1

0.875

0.75

0.625

0.5

0.5

0.25

0.25

quantile

Returns the rank of a value for a range that you specify. It returns integers to represent any range of ranks, such as 1 (highest) to 100 (lowest). The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
quantile ( numeric_expr, numeric_expr  [ at exp {, expr
} ]  [ <for-option> ] [ prefilter ] ) 
quantile ( [ distinct ] numeric_expr, numeric_expr  [ <for-option>
] [ prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto  
Example
quantile ( Qty, 4 ) 

Result: The quantity, the rank of the quantity value, and the quantity values broken down into 4 quantile groups (quartiles) are displayed.

Qty

------

800

700

600

500

400

400

200

200

Rank (Qty)

-----------------

1

2

3

4

5

5

7

7

Quantile (Qty, 4)

-----------------------

1

1

2

2

3

3

4

4

quartile

Returns the rank of a value, represented as integers from 1 (highest) to 4 (lowest), relative to a group of values. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
quartile ( numeric_expr  [ at exp {, expr } ]  [ <for-option>
] [ prefilter ] ) 
quartile ( [ distinct ] numeric_expr [ <for-option> ] [ prefilter
] ) 
<for-option> ::= for expr {, expr } | for report | auto  
Example
quartile ( Qty ) 

Result: The quantity and the quartile of the quantity value represented as integers from 1 (highest) to 4 (lowest) are displayed.

Qty

------

450

400

350

300

250

200

150

100

Quartile (Qty)

---------------------

1

1

2

2

3

3

4

4

rank

Returns the rank value of selected data items. The sort order is optional; descending order (DESC) is assumed by default. If two or more rows tie, then there is a gap in the sequence of ranked values (also known as Olympic ranking). The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct' is available for backward compatibility of expressions used in previous versions of the product. Null values are ranked last.

Syntax
rank ( expr [ ASC | DESC ] {, expr [ ASC | DESC ] } 
[ at exp {, expr } ]  [ <for-option> ] [ prefilter ] ) 
rank ( [ distinct ] expr [ ASC | DESC ] {, expr [ ASC | DESC ] }
[ <for-option>]  [ prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto  
Example
rank ( Sales 98 ) 

Result: For each row, the rank value of sales for 1998 that is attributed to each sales representative is displayed. Some numbers are skipped when a tie between rows occurs.

Sales Rep

----------------

Bill Gibbons

Bjorn Flertjan

Chris Cornel

John Smith

Sales 98

-----------

60000

50000

50000

48000

Rank

------------

1

2

2

4

running-average

Returns the running average by row (including the current row) for a set of values. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
running-average ( numeric_expr  [ at exp {, expr } ]
 [ <for-option> ] [ prefilter ] ) 
running-average ( [ distinct ] numeric_expr [ <for-option> ]
[ prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto  
Example
running-average ( Qty ) 

Result: For each row, the quantity and a running average of the current and the previous rows are displayed.

Name

-------

Smith

Smith

Smith

Smith

Wong

Wong

Qty

------

7

3

6

4

3

5

Avg

------

5

5

5

5

4

4

Running-Average for name

---------------------------

7

5

5.33

5

3

4

running-count

Returns the running count by row (including the current row) for a set of values. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
running-count ( numeric_expr  [ at exp {, expr } ]  [
<for-option> ] [ prefilter ] ) 
running-count ( [ distinct ] numeric_expr  [ <for-option> ] [
prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto 
Example
running-count ( Qty ) 

Result: For each row, the quantity and a running count of the position of the current row are displayed.

Name

-------

Smith

Smith

Smith

Smith

Wong

Wong

Qty

------

7

3

6

4

3

5

Count

---------

4

4

4

4

3

3

Running-Count for name

--------------------------

1

2

3

4

1

2

running-difference

Returns a running difference by row, calculated as the difference between the value for the current row and the preceding row, (including the current row) for a set of values. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
running-difference ( numeric_expr [ at exp {, expr }
]  [ <for-option> ] [ prefilter ] ) 
running-difference ( [ distinct ] numeric_expr  [ <for-option>
] [ prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto 
Example
running-difference ( Qty ) 

Result: For each row, the quantity and a running difference between the value for the current row and the preceding row are displayed.

Name

-------

Smith

Smith

Smith

Smith

Wong

Wong

Qty

------

7

3

6

4

3

5

Running-Difference for name

--------------------------------------

NULL

-4

3

-2

-1

2

running-maximum

Returns the running maximum by row (including the current row) for a set of values. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
running-maximum (  numeric_expr  [ at exp {, expr } ]
 [ <for-option> ] [ prefilter ] ) 
running-maximum ( [ distinct ] numeric_expr  [ <for-option> ]
[ prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto 
Example
running-maximum ( Qty ) 

Result: For each row, the quantity and a running maximum of the current and previous rows are displayed.

Name

-------

Smith

Smith

Smith

Smith

Wong

Wong

Qty

------

2

3

6

7

3

5

Max

------

7

7

7

7

5

5

Running-Maximum (Qty) for name

---------------------------------

2

3

6

7

3

5

running-minimum

Returns the running minimum by row (including the current row) for a set of values. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
running-minimum ( numeric_expr  [ at exp {, expr } ]
 [ <for-option> ] [ prefilter ] ) 
running-minimum ( [ distinct ] numeric_expr  [ <for-option> ]
[ prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto 
Example
running-minimum ( Qty ) 

Result: For each row, the quantity and a running minimum of the current and previous rows are displayed.

Name

-------

Smith

Smith

Smith

Smith

Wong

Wong

Qty

-----

7

3

6

2

4

5

Min

------

2

2

2

2

3

3

Running-Minimum (Qty) for name

----------------------------------

7

3

3

2

4

4

running-total

Returns a running total by row (including the current row) for a set of values. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can only be used in the context of relational datasources. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
running-total ( numeric_expr [ at exp {, expr } ]   [
<for-option> ] [ prefilter ] ) 
running-total ( [ distinct ] numeric_expr  [ <for-option> ] [
prefilter ] ) 
<for-option> ::= for expr {, expr } | for report | auto 
Example
running-total ( Qty ) 

Result: For each row, the quantity and a running total of the current and previous rows are displayed.

Name

-------

Smith

Smith

Smith

Smith

Wong

Wong

Qty

------

2

3

6

7

3

5

Total

--------

18

18

18

18

12

12

Running-Total (Qty) for name

---------------------------------

2

5

11

18

3

8

standard-deviation

Returns the standard deviation of selected data items. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
standard-deviation ( [ distinct ] expr [ auto ] ) 
standard-deviation ( [ distinct ] expr for [ all | any ] expr {
, expr } ) 
standard-deviation ( [ distinct ] expr for report ) 
Example
standard-deviation ( ProductCost ) 

Result: A value indicating the deviation between product costs and the average product cost.

standard-deviation-pop

Computes the population standard deviation and returns the square root of the population variance. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
standard-deviation-pop ( [ distinct ] expr [ auto ] ) 
standard-deviation-pop ( [ distinct ] expr for [ all | any ] expr
{ , expr } ) 
standard-deviation-pop ( [ distinct ] expr for report ) 
Example
standard-deviation-pop ( ProductCost ) 

Result: A value of the square root of the population variance.

total

Returns the total value of selected data items. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
total ( [ distinct ] expr [ auto ] ) 
total ( [ distinct ] expr for [ all | any ] expr { , expr } ) 
total ( [ distinct ] expr for report ) 
Example
total ( Sales ) 

Result: The total value of all Sales values.

variance

Returns the variance of selected data items. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product.

Syntax
variance ( [ distinct ] expr [ auto ] ) 
variance ( [ distinct ] expr for [ all | any ] expr { , expr } ) 
variance ( [ distinct ] expr for report ) 
Example
variance ( Product Cost ) 

Result: A value indicating how widely product costs vary from the average product cost.

variance-pop

Returns the population variance of a set of numbers after discarding the nulls in this set. The keyword "distinct" is available for backward compatibility of expressions used in previous versions of the product

Syntax
variance-pop ( [ distinct ] expr [ auto ] ) 
variance-pop ( [ distinct ] expr for [ all | any ] expr { , expr
} ) 
variance-pop ( [ distinct ] expr for report ) 
Example
variance-pop ( Qty) 

Result: For each row, this displays the population variance of a set of numbers after discarding the nulls in this set.

Member Summaries

This list contains predefined functions that return either a single summary value for a set of members or a different summary value for each member of a set of members.

aggregate

Returns a calculated value using the appropriate aggregation function, based on the aggregation type of the expression.

Syntax
aggregate ( < currentMeasure | numeric_expr > within
set set_expr ) 
aggregate ( < currentMeasure | numeric_expr > within < detail
| aggregate > expr ) 

average

Returns the average value of the selected data items.

Syntax
average ( < currentMeasure | numeric_expr > within
set set_expr ) 
average ( < currentMeasure | numeric_expr > within < detail
| aggregate > expr ) 

count

Returns the number of selected data items excluding NULL values.

Syntax
count ( < currentMeasure | numeric_expr > within set
set_expr ) 
count ( < currentMeasure | numeric_expr > within < detail
| aggregate > expr ) 

maximum

Returns the maximum value of selected data items.

Syntax
maximum ( < currentMeasure | numeric_expr > within
set set_expr ) 
maximum ( < currentMeasure | numeric_expr > within < detail
| aggregate > expr ) 

median

Returns the median value of selected data items.

Syntax
median ( < currentMeasure | numeric_expr > within
set set_expr ) 
median ( < currentMeasure | numeric_expr > within < detail
| aggregate > expr ) 

minimum

Returns the minimum value of selected data items.

Syntax
minimum ( < currentMeasure | numeric_expr > within
set set_expr ) 
minimum ( < currentMeasure | numeric_expr > within < detail
| aggregate > expr ) 

percentage

Returns the percent of the total value for the selected data items.

Syntax
percentage ( numeric_expr  [ tuple member_expr {, member_expr
} ] within set set_expr ) 
Example
percentage ( [gosales].[sales measures].[quantity] tuple [gosales].[Staff].[].[department]->[West]
within set children([gosales].[Staff].[].[Staff] ) 

percentile

Returns a value, on a scale from 0 to 100, that indicates the percent of a distribution that is equal to or below the selected data items.

Syntax
percentile ( numeric_expr  [ tuple member_expr {, member_expr
} ] within set set_expr ) 

quantile

Returns the rank of a value for the specified range. It returns integers to represent any range of ranks, such as 1 (highest) to 100 (lowest).

Syntax
quantile ( numeric_expr, numeric_expr  [ tuple member_expr
{, member_expr } ] within set set_expr ) 

quartile

Returns the rank of a value, represented as integers from 1 (highest) to 4 (lowest), relative to a group of values.

Syntax
quartile ( numeric_expr [ tuple member_expr {, member_expr
} ] within set set_expr ) 

rank

Returns the rank value of the selected data items. The type of ranking returned (Olympic, dense, or serial) is data source dependent. The sort order is optional; DESC is assumed by default.

Syntax
rank ( numeric_expr [ ASC | DESC ] [ tuple member_expr
{, member_expr } ] within set set_expr  ) 
Example
rank  ( [gosales].[sales measures].[quantity] tuple [gosales].[Staff].[].[department]->[West]
within set children([gosales].[Staff].[].[Staff] ) 

standard-deviation

Returns the standard deviation of the selected data items.

Syntax
standard-deviation ( < currentMeasure | numeric_expr
> within set set_expr ) 
standard-deviation ( < currentMeasure | numeric_expr > within
< detail | aggregate > expr ) 

standard-deviation-pop

Returns the standard deviation population of the selected data items.

Syntax
standard-deviation-pop ( < currentMeasure | numeric_expr
> within set set_expr ) 
standard-deviation-pop ( < currentMeasure | numeric_expr > within
< detail | aggregate > expr ) 

total

Returns the total value of the selected data items.

Syntax
total ( < currentMeasure | numeric_expr > within set
set_expr ) 
total ( < currentMeasure | numeric_expr > within < detail
| aggregate > expr ) 

variance

Returns the variance of the selected data items.

Syntax
variance ( < currentMeasure | numeric_expr > within
set set_expr ) 
variance ( < currentMeasure | numeric_expr > within < detail
| aggregate > expr ) 

variance-pop

Returns the variance population of the selected data items.

Syntax
variance-pop ( < currentMeasure | numeric_expr > within
set set_expr ) 
variance-pop ( < currentMeasure | numeric_expr > within <
detail | aggregate > expr ) 

Constants

A constant is a fixed value that you can use in an expression.

date

Inserts the current system date.

date-time

Inserts the current system date and time.

time with time zone

Inserts a zero time with time zone.

timestamp with time zone

Inserts an example of a timestamp with time zone.

interval

Inserts a zero interval.

interval year

Inserts a zero year interval.

interval month

Inserts a zero month interval.

interval year to month

Inserts a zero year to month interval.

interval day

Inserts a zero day interval.

interval hour

Inserts a zero hour interval.

interval minute

Inserts a zero minute interval.

interval second

Inserts a zero second interval.

interval day to hour

Inserts a zero day to hour interval.

interval day to minute

Inserts a zero day to minute interval.

interval day to second

Inserts a zero day to second interval.

interval hour to minute

Inserts a zero hour to minute interval.

interval hour to second

Inserts a zero hour to second interval.

interval minute to second

Inserts a zero minute to second interval.

null

Inserts a NULL value if the expression conditions are not met.

number

Inserts the number 0, which can be replaced with a new numeric value.

string

Inserts an empty string.

time

Inserts the current system time.

Constructs

This list contains constructs and templates that can be used to create an expression.

if then else

This is the template for using an "IF...THEN...ELSE" statement in the expression.

Syntax
IF ([Country] = 'Canada')  
    THEN ([List Price] * 0.60)  
    ELSE ([List Price]) 

in_range

This is the template for using "IN_RANGE" in the expression.

Syntax
[code] IN_RANGE { :30 , 40, 50, 999: } 
Example 1
[code] IN_RANGE { 5 } 

Result: This is equivalent to [code] = 5

Example 2
[code] IN_RANGE { 5: } 

Result: This is equivalent to [code] >= 5

Example 3
[code] IN_RANGE { :5 } 

Result: This is equivalent to [code] <= 5

Example 4
[code] IN_RANGE { 5:10 } 

Result: This is equivalent to ( [code] >= 5 and [code] <= 10 )

Example 5
[code] IN_RANGE { :5,10,20: } 

Result: This is equivalent to ( [code] <= 5 or [code] = 10 or [code] >= 20 )

search case

This is the template for using a "search case" in the expression.

Syntax
CASE 
    WHEN [Country] = 'Canada' THEN ([List Price] * 0.60)  
    WHEN [CountryCode] > 100 THEN [List Price] * 0.80  
    ELSE [List Price] 
END 

simple case

This is the template for using a "simple case" in the expression.

Syntax
CASE [Country]  
    WHEN 'Canada' THEN ([List Price] * 0.60)  
    WHEN 'Australia' THEN [List Price] * 0.80  
    ELSE [List Price] 
END 

Business Date/Time Functions

This list contains business functions for performing date and time calculations.

_add_days

Returns the date or datetime, depending on the first argument, that results from adding "integer_exp" days to "date_exp".

Syntax
_add_days ( date_exp, integer_exp ) 
Example 1
_add_days ( 2002-04-30 , 1 ) 

Result: 2002-05-01

Example 2
_add_days ( 2002-04-30 12:10:10.000, 1 ) 

Result: 2002-05-01 12:10:10.000

Example 3
_add_days ( 2002-04-30 00:00:00.000, 1/24 )
Note that the second argument is not a whole number. This is supported
by some database technologies and increments the time portion. 

Result: 2002-04-30 01:00:00.000

_add_months

Returns the date or datetime, depending on the first argument, that results from the addition of "integer_exp" months to "date_exp".

Syntax
_add_months ( date_exp, integer_exp ) 
Example 1
_add_months ( 2002-04-30 , 1 ) 

Result: 2002-05-30

Example 2
_add_months ( 2002-04-30 12:10:10.000, 1 ) 

Result: 2002-05-30 12:10:10.000

_add_years

Returns the date or datetime, depending on the first argument, that results from the addition of "integer_exp" years to "date_exp".

Syntax
_add_years ( date_exp, integer_exp ) 
Example 1
_add_years ( 2002-04-30 , 1 ) 

Result: 2003-04-30

Example 2
_add_years ( 2002-04-30 12:10:10.000 , 1 ) 

Result: 2003-04-30 12:10:10.000

_age

Returns a number that is obtained from subtracting "date_exp" from today’s date. The returned value has the form YYYYMMDD, where YYYY represents the number of years, MM represents the number of months, and DD represents the number of days.

Syntax
_age (date_exp )  
Example
Today's date=2003-02-05 _age ( 1990-04-30 ) 

Result: 120906 that is 12 years, 9 months and 6 days

_day_of_week

Returns the day of week (1 to 7), where 1 is the first day of the week as indicated by the second parameter(1 to 7, 1 being Monday and 7 being Sunday). Note that in ISO 8601 standard, a week begins with Monday being day 1.

Syntax
_day_of_week ( date_exp, integer )  
Example
_day_of_week ( 2003-01-01, 1 ) 

Result: 3

_day_of_year

Returns the ordinal for the day of the year in "date_ exp" (1 to 366). Also known as Julian day.

Syntax
_day_of_year ( date_exp )  
Example
_day_of_year ( 2003-03-01 ) 

Result: 61

_days_between

Returns a positive or negative number representing the number of days between "date_exp1" and "date_exp2". If "date_exp1" < "date_exp2" then the result will be a negative number.

Syntax
_days_between ( date_exp1, date_exp2 ) 
Example
_days_between ( 2002-04-30 , 2002-06-21 ) 

Result: -52

_days_to_end_of_month

Returns a number representing the number of days remaining in the month represented by "date_exp".

Syntax
_days_to_end_of_month ( date_exp ) 
Example
_days_to_end_of_month ( 2002-04-20 14:30:22.123 ) 

Result: 10

_first_of_month

Returns a date or datetime, depending on the argument, that is obtained from converting "date_exp" to a date with the same year and month but with the day set to 1.

Syntax
_first_of_month ( date_exp ) 
Example 1
_first_of_month ( 2002-04-20 ) 

Result: 2002-04-01

Example 2
_first_of_month ( 2002-04-20 12:10:10.000 ) 

Result: 2002-04-01 12:10:10.000

_last_of_month

Returns a date or datetime, depending on the argument, that is the last day of the month represented by "date_exp".

Syntax
_last_of_month ( date_exp ) 
Example 1
_last_of_month ( 2002-01-14 ) 

Result: 2002-01-31

Example 2
_last_of_month ( 2002-01-14 12:10:10.000 ) 

Result: 2002-01-31 12:10:10.000

_make_timestamp

Returns a timestamp constructed from "integer_exp1" (the year), "integer_exp2" (the month), and "integer_exp3" (the day). The time portion defaults to 00:00:00.000 .

Syntax
_make_timestamp ( integer_exp1, integer_exp2, integer_exp3
) 
Example
_make_timestamp ( 2002 , 01 , 14 ) 

Result: 2002-01-14 00:00:00.000

_months_between

Returns a positive or negative integer number representing the number of months between "date_exp1" and "date_exp2". If "date_exp1" < "date_exp2" then a negative number is returned.

Syntax
_months_between ( date_exp1, date_exp2 ) 
Example
_months_between ( 2002-01-30, 2002-04-03 ) 

Result: 2

_week_of_year

Returns the number of the week of the year of "date_exp" according to the ISO 8601 standard. Week 1 of the year is the first week of the year to contain a Thursday, which is equivalent to the first week containing January 4th. A week starts on Monday (day 1) and ends on Sunday (day 7).

Syntax
_week_of_year ( date_exp ) 
Example
_week_of_year ( 2003-01-01 ) 

Result: 1

_years_between

Returns a positive or negative integer number representing the number of years between "date_exp1" and "date_exp2". If "date_exp1" < "date_exp2" then a negative value is returned.

Syntax
_years_between ( date_exp1, date_exp2 ) 
Example
_years_between ( 2003-01-30, 2001-04-03 ) 

Result: 1

_ymdint_between

Returns a number representing the difference between "date_exp1" and "date_exp2". The returned value has the form YYYYMMDD, where YYYY represents the number of years, MM represents the number of months, and DD represents the number of days.

Syntax
_ymdint_between ( date_exp1, date_exp2 ) 
Example
_ymdint_between ( 1990-04-30 , 2003-02-05 ) 

Result: 120906 that is 12 years, 9 months and 6 days

Block Functions

This list contains functions used to access members of a set, usually in the context of Analysis Studio.

_firstFromSet

Returns the first members found in the set up to "numeric_exp_max" + "numeric_exp_overflow". If "numeric_exp_max" + "numeric_exp_overflow" is exceeded, then only the max number of members are returned.

Syntax
_firstFromSet ( set_exp, numeric_exp_max , numeric_exp_overflow
) 

_remainderSet

Returns the set containing "member_exp" when the size of "set_exp" is greater than "numeric_exp".

Syntax
_remainderSet (member_exp,  set_exp , numeric_exp ) 

Macro Functions

This list contains functions that can be used within a macro. A macro may contain one or more macro functions. A macro is delimited by a number sign (#) at the beginning and at the end. Everything between the number signs is treated as a macro expression and is executed at run time. For macro functions that accept expressions of datatype timestamp with time zone as arguments, the accepted format is 'yyyy-mm-dd hh:mm:ss[.ff]+hh:mm' where fractional seconds are optional and can be represented by 1 to 9 digits. In lieu of a space separating the date portion to the time portion, the character 'T' is also accepted. Also, in lieu of the time zone '+hh:mm', the character 'Z' is accepted and will be processed internally as '+00:00'. The macro functions that return expressions of datatype timestamp with time zone return 9 digits by default for their fractional seconds. The macro function timestampMask() can be used to trim the output if required.

+

Concatenates two strings.

Syntax
value1 + value2 
Example
# '{' + $runLocale + '}'# 

Result: {en-us}

_add_days

Returns the timestamp with time zone (as a string) that results from adding "integer_exp" number of days to "string_exp", where "string_exp" represents a timestamp with time zone.

Syntax
_add_days ( string_exp , integer_exp ) 
Example 1
#_add_days ( '2005-11-01 12:00:00.000-05:00' , -1 )# 

Result: 2005-10-31 12:00:00.000000000-05:00

Example 2
#_add_days ( $current_timestamp , 1 )# 

Result: 2005-11-02 12:00:00.000000000-05:00

Example 3
#timestampMask ( _add_days ( $current_timestamp , 1 )
, 'yyyy-mm-dd' )# 

Result: 2005-11-02

_add_months

Returns the timestamp with time zone (as a string) that results from adding "integer_exp" number of months to "string_exp", where "string_exp" represents a timestamp with time zone.

Syntax
_add_months ( string_exp , integer_exp ) 
Example 1
#_add_months ( '2005-11-01 12:00:00.000-05:00' , -1 )# 

Result: 2005-10-01 12:00:00.000000000-05:00

Example 2
#_add_months ( $current_timestamp , 1 )# 

Result: 2005-12-01 12:00:00.000000000-05:00

Example 3
#timestampMask ( _add_months ( $current_timestamp , 1
) , 'yyyy-mm-dd' )# 

Result: 2005-12-01

_add_years

Returns the timestamp with time zone (as a string) that results from adding "integer_exp" number of years to "string_exp", where "string_exp" represents a timestamp with time zone.

Syntax
_add_years ( string_exp , integer_exp ) 
Example 1
#_add_years ( '2005-11-01 12:00:00.000-05:00' , -1 )# 

Result: 2004-11-01 12:00:00.000000000-05:00

Example 2
#_add_years ( $current_timestamp , 1 )# 

Result: 2006-11-01 12:00:00.000000000-05:00

Example 3
#timestampMask ( _add_years ( $current_timestamp , 1
) , 'yyyy-mm-dd' )# 

Result: 2006-11-01

array

Constructs an array out of the list of parameters.

Syntax
array ( string_exp | array_exp { , string_exp | array_exp
} ) 
Example
#csv ( array ( 'a1' , array ( 'x1' , 'x2' ) , 'a2' )
)# 

Result: 'a1' , 'x1' , 'x2' , 'a2'

csv

Constructs a string from the elements of the array where the values are separated by commas. Optionally, the separator and quote strings can be specified. The default separator is a comma ( , ) and the default quote character is a single quote ( ' ).

Syntax
csv ( array_exp [ , separator_string [ , quote_string
] ] ) 
Example
#csv ( array ( 'a1' , 'a2' ) )# 

Result: 'a1' , 'a2'

dq

Surrounds the passed string with double quotes.

Syntax
dq ( string_exp ) 
Example
#dq ( 'zero' )# 

Result: "zero"

grep

Searches for and returns elements of an array that match the pattern specified in "pattern_string".

Syntax
grep ( pattern_string , array_exp ) 
Example
#csv ( grep ( 's' , array ( 'as', 'an', 'arts' ) ) )# 

Result: 'as', 'arts'

_first_of_month

Returns a timestamp with time zone (as a string) converting the day of "string_exp" to 1, where "string_exp" is a timestamp with time zone.

Syntax
_first_of_month ( string_exp ) 
Example 1
#_first_of_month ( '2005-11-11 12:00:00.000-05:00' )# 

Result: 2005-11-01 12:00:00.000000000-05:00

Example 2
#timestampMask ( _first_of_month ( '2005-11-11 12:00:00.000-05:00'
), 'yyyymmdd' )# 

Result: 20051101

_last_of_month

Returns a timestamp with time zone (as a string) that is the last day of the month represented by "string_exp", where "string_exp" is a timestamp with time zone.

Syntax
_last_of_month ( string_exp ) 
Example 1
#_last_of_month ( '2005-11-11 12:00:00.000-05:00' )# 

Result: 2005-11-30 12:00:00.000000000-05:00

Example 2
#timestampMask ( _last_of_month ( '2005-11-11 12:00:00.000-05:00'
) , 'yyyy-mm-dd' ) # 

Result: 2005-11-30

join

Joins the elements of an array using the separator string.

Syntax
join ( separator_string , array_exp ) 
Example
# sq ( join ( ' | | ' , array ( 'as', 'an', 'arts' )
) )# 

Result: 'as | | an | | arts'

prompt

Prompts the user for a single value. Only "prompt_name" is required. The datatype defaults to string when not specified. The prompt is optional when "defaultText" is specified. "Text", when specified, will precede the value. "QueryItem" can be specified to take advantage of the prompt info properties of "queryItem". "Trailing_text", when specified, will be appended to the value.

Syntax
prompt ( prompt_name , datatype , defaultText , text
, queryItem , trailing_text ) 
Example 1
select . . . where COUNTRY_MULTILINGUAL.COUNTRY_CODE
 > #prompt('Starting CountryCode',
                   'integer',
                   '10'
)# 

Result: select . . . where COUNTRY_MULTILINGUAL.COUNTRY_CODE > 10

Example 2
[gosales].[COUNTRY].[COUNTRY] = #prompt('countryPrompt','string','''Canada''')# 

Result: [gosales].[COUNTRY].[COUNTRY] = 'Canada'

Notes

promptmany

Prompts the user for one or more values. Only "prompt_name" is required. The datatype defaults to string when not specified. The prompt is optional when "defaultText" is specified. "Text", when specified, will precede the list of values. "QueryItem" can be specified to take advantage of the prompt info properties of "queryItem". "Trailing_text", when specified, will be appended to the list of values.

Syntax
promptmany ( prompt_name , datatype , defaultText , text
, queryItem , trailing_text ) 
Example 1
select . . . where COUNTRY_MULTILINGUAL.COUNTRY IN (
#promptmany ( 'CountryName' ) # )
 

Result: select . . . where COUNTRY_MULTILINGUAL.COUNTRY_CODE IN ('Canada' , 'The Netherlands' , 'Russia')

Example 2
select . . . 
from 
gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL,
gosales.gosales.dbo.COUNTRY XX
where COUNTRY_MULTILINGUAL.COUNTRY_CODE = XX.COUNTRY_CODE
    #promptmany('Selected CountryCodes',
                   'integer',
                   ' ',
   ' and  COUNTRY_MULTILINGUAL.COUNTRY_CODE IN (',
                   '',
                   ')'
)#
 

Result: select . . . from gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL, gosales.gosales.dbo.COUNTRY XX where COUNTRY_MULTILINGUAL.COUNTRY_CODE = XX.COUNTRY_CODE and COUNTRY_MULTILINGUAL.COUNTRY_CODE IN ('Canada' , 'The Netherlands' , 'Russia')

sb

Surrounds the passed string with square brackets.

Syntax
sb ( string_exp ) 
Example
#sb ( 'abc' )# 

Result: [abc]

sq

Surrounds the passed string with single quotes.

Syntax
sq ( string_exp ) 
Example
#sq ( 'zero' )# 

Result: 'zero'

sort

Sorts the elements of the array in alphabetical order. Duplicates are retained.

Syntax
sort ( array_exp ) 
Example
#csv ( sort ( array ( 's3', 'a', 'x' ) ) )# 

Result: 'a', 's3', 'x'

split

Splits a string or string elements of the array into separate elements.

Syntax
split ( pattern_string, string_exp | array_exp ) 
Example 1
#csv ( split ( '::', 'ab=c::de=f::gh=i' ) )# 

Result: 'ab=c' , 'de=f', 'gh=i'

Example 2
#csv ( split ( '=' , split ( '::', 'ab=c::de=f::gh=i'
) ) )# 

Result: 'ab' , 'c' , 'de' , 'f', 'gh' , 'i'

substitute

Searches for a pattern in a string or in the string elements of an array and substitutes the first occurrence of "pattern_string" with "replacement_string".

Syntax
substitute ( pattern_string, replacement_string, string_exp
| array_exp ) 
Example 1
#sq ( substitute ( '^cn=', '***', 'cn=help' ) )# 

Result: '***help'

Example 2
#csv ( substitute ( '^cn=', '***', array ( 'cn=help'
, 'acn=5' ) ) )# 

Result: '***help' , 'acn=5'

Example 3
#csv ( substitute ( 'cn=', '', array ( 'cn=help' , 'acn=5'
) ) )# 

Result: 'help' , 'a5'

timestampMask

Returns "string_exp1", representing a timestamp with time zone, trimmed to the format specified in "string_exp2". The format in "string_exp2" must be one of the following: 'yyyy', 'mm', 'dd', 'yyyy-mm', 'yyyymm', 'yyyy-mm-dd', 'yyyymmdd', 'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:mm:ss+hh:mm', 'yyyy-mm-dd hh:mm:ss.ff3', 'yyyy-mm-dd hh:mm:ss.ff3+hh:mm', 'yyyy-mm-ddThh:mm:ss', 'yyyy-mm-ddThh:mm:ss+hh:mm', 'yyyy-mm-ddThh:mm:ss.ff3+hh:mm', or 'yyyy-mm-ddThh:mm:ss.ff3+hh:mm'. The macro functions that return a string representation of a timestamp with time zone show a precision of 9 digits for the fractional part of the seconds by default. The format options allow this to be trimmed down to a precision of 3 or 0.

Syntax
timestampMask ( string_exp1, string_exp2 ) 
Example 1
#timestampMask ( $current_timestamp, 'yyyy-dd-mm' )# 

Result: 2005-11-01

Example 2
#timestampMask (  '2005-11-01 12:00:00.000-05:00', 'yyyy-mm-dd hh:mm:ss+hh:mm'
)# 

Result: 2005-11-01 12:00:00-05:00

Example 3
#timestampMask (  '2005-11-01 12:00:00.123456789-05:00', 'yyyy-mm-ddThh:mm:ss+hh:mm.ff3+hh:mm'
)# 

Result: 2005-11-01T12:00:00.123-05:00

toLocal

Returns the string representing a timestamp with time zone resulting from adjusting "string_exp" to the time zone of the operating system. Note that the macro function timestampMask() can be used to trim the output.

Syntax
toLocal ( string_exp ) 
Example 1
#toLocal ( '2005-11-01 17:00:00.000-00:00' )# where OS
local time zone is -05:00 

Result: 2005-11-01 12:00:00.000000000-05:00

Example 2
#timestampMask( toLocal ( '2005-11-01 17:00:00.000-00:00'
) , 'yyyy-mm-dd hh:mm:ss+hh:mm' )# where OS local time zone is -05:00 

Result: 2005-11-01 12:00:00-05:00

Example 3
#toLocal ( '2005-11-01 13:30:00.000-03:30' )# where OS
local time zone is -05:00 

Result: 2005-11-01 12:00:00.000000000-05:00

toUTC

Returns the string representing a timestamp with time zone resulting from adjusting "string_exp" to the zero-point reference UTC time zone, also known as GMT time. Note that the macro function timestampMask() can be used to trim the output.

Syntax
toUTC ( string_exp )  
Example 1
#toUTC ( '2005-11-01 12:00:00.000-05:00' )# 

Result: 2005-11-01 17:00:00.000000000-00:00

Example 2
#timestampMask( toUTC ( '2005-11-01 12:00:00.000-05:00'
) , 'yyyy-mm-dd hh:mm:ss.ff3+hh:mm' )#  

Result: 2005-11-01 17:00:00.000-00:00

Example 3
#toUTC ( $current_timestamp )# 

Result: 2005-11-01 17:00:00.000000000-00:00

unique

Removes duplicate entries from the array. The order of the elements is retained.

Syntax
unique ( array_exp ) 
Example
Example:
#csv ( unique ( array ( 's3', 'a', 's3', 'x' ) ) )# 

Result: 's3', 'a', 'x'

urlencode

URL encodes the passed argument. Useful when specifying XML connection strings.

Syntax
urlencode(prompt('userValue')) 
Example
urlencode(prompt('some_val')) 

Result: %27testValue%27

CSVIdentityName

Uses the identity information of the current authenticated user to look up values in the specified parameter map. Each individual piece of the user's identity (account name, group names, role names) is used as a key into the map. The unique list of values that is retrieved from the map is then returned as a string, where each value is surrounded by single quotes and where multiple values are separated by commas.

Syntax
CSVIdentityName ( %parameter_map_name [ , separator_string
] ) 
Example
#CSVIdentityName ( %security_clearance_level_map )# 

Result: 'level_500' , 'level_501' , 'level_700'

CSVIdentityNameList

Returns the pieces of the user's identity (account name, group names, role names) as a list of strings. The unique list of values is returned as a string, where each value is surrounded by single quotes and where multiple values are separated by commas.

Syntax
CSVIdentityNameList ( [ separator_string ] ) 
Example
#CSVIdentityNameList ( )# 

Result: 'Everyone' , 'Report Administrators' , 'Query User'

CAMPassport

Returns the passport.

Syntax
CAMPassport ( ) 
Example
#CAMPassport ( )# 

Result: 111:98812d62-4fd4-037b-4354-26414cf7ebef:3677162321

CAMIDList

Returns the pieces of the user's identity (account name, group names, role names) as a list of values separated by commas.

Syntax
CAMIDList ( [ separator_string ] ) 
Example
#CAMIDList ( )# 

Result: CAMID("::Everyone"), CAMID(":Authors"), CAMID(":Query Users"), CAMID(":Consumers"), CAMID(":Metrics Authors")

CAMIDListForType

Returns an array of the user's identities based on the identity type (account, group, or role). It can be used with the macro functions csv or join.

Syntax
CAMIDListForType ( identity type ) 
Example
[qs].[userRole] IN ( #csv ( CAMIDListForType ( 'role'
) ) # )  

Result: [qs].[userRole] IN ( 'CAMID("::System Administrators")', 'CAMID(":Authors")' )

Common Functions

nullif

Returns NULL if "exp1" equals "exp2", otherwise returns "exp1".

Syntax
nullif ( exp1, exp2 ) 

_format

Associates a format with the expression. The keyword can be PERCENTAGE_0, PERCENTAGE_1 or PERCENTAGE_2.

Syntax
_format ( expr , keyword  ) 
Example
_format( [Unit Sale Price] / [Unit Price] , PERCENTAGE_2
) 

Result: 0.75123 displayed as 75.12%

_round

Returns "numeric_exp" rounded to "integer_exp" places to the right of the decimal point. Note: "Integer_exp" must be a non-negative integer.

Syntax
_round ( numeric_exp, integer_exp ) 
Example
_round ( 1220.42369, 2 ) 

Result: 1220.42

abs

Returns the absolute value of "numeric_exp". Negative values are returned as positive values.

Syntax
abs ( numeric_exp ) 
Example 1
abs ( 15 ) 

Result: 15

Example 2
abs ( -15 ) 

Result: 15

ancestor

Returns the ancestor of the specified member at either the specified (named) level or the specified number of levels above the member. Note: The result is not guaranteed to be consistent when there is more than one such ancestor.

Syntax
ancestor ( member, level | integer ) 

ancestors

Returns all the ancestors of a member at a specified level or distance above the member. (Most data sources support only one ancestor at a specified level, but some support more than one. Hence the result is a member set.)

Syntax
ancestors ( member , level | index ) 

bottomCount

Sorts a set according to the value of "numeric_exp" evaluated at each of the members of "set_exp" and returns the bottom "index_exp" members.

Syntax
bottomCount ( set_exp , index_exp , numeric_exp ) 

bottomPercent

Sorts "numeric_exp2", evaluated at the corresponding member of "set_exp", and picks up the bottommost elements whose cumulative total is equal to or less than "numeric_exp1" percent of the total.

Syntax
bottomPercent ( set_exp , numeric_exp1 , numeric_exp2
) 

bottomSum

Sorts "numeric_exp2", evaluated at the corresponding member of "set_exp", and picks up the bottommost elements whose cumulative total is equal to or less than "numeric_exp1".

Syntax
bottomSum ( set_exp , numeric_exp1 , numeric_exp2 ) 

caption

Returns the caption values of the specified argument.

Syntax
caption ( level | member | set_exp ) 

cast

Converts "exp" to a specified data type. Some data types allow for a length and precision to be specified. Make sure that the target is of the appropriate type and size. The following datatypes can be specified: CHARACTER, VARCHAR, CHAR, NUMERIC, DECIMAL, INTEGER, SMALLINT, REAL, FLOAT, DATE, TIME, TIMESTAMP, TIME WITH TIME ZONE, TIMESTAMP WITH TIME ZONE, and INTERVAL. When type casting to an INTERVAL type, one of the following interval qualifiers must be specified: YEAR, MONTH, or YEAR TO MONTH for the year-to-month interval datatype; DAY, HOUR, MINUTE, SECOND, DAY TO HOUR, DAY TO MINUTE, DAY TO SECOND, HOUR TO MINUTE, HOUR TO SECOND, or MINUTE TO SECOND for the day-to-second interval datatype. More notes for this function are included in the user guide.

Syntax
cast ( exp, datatype_specification ) 
Example 1
cast ( '123' , integer ) 

Result: 123

Example 2
cast ( 12345 , VARCHAR ( 10 ) ) 

Result: a string containing 12345

Notes

ceil

Returns the smallest integer greater than or equal to "numeric_exp".

Syntax
ceil ( numeric_exp ) 

ceiling

Returns the smallest integer greater than or equal to "numeric_exp".

Syntax
ceiling ( numeric_exp ) 
Example 1
ceiling ( 4.22 ) 

Result: 5

Example 2
ceiling ( -1.23 ) 

Result: -1

char_length

Returns the number of characters in "string_exp".

Syntax
char_length ( string_exp ) 
Example
char_length ( 'Canada' ) 

Result: 6

character_length

Returns the number of characters in "string_exp".

Syntax
character_length ( string_exp ) 
Example
character_length ( 'Canada' ) 

Result: 6

children

Returns the set of children of a specified member.

Syntax
children ( member ) 

closingPeriod

Returns the last sibling among the descendants of a member at a specified level. Typically used with a time dimension.

Syntax
closingPeriod ( level [, member ] ) 

coalesce

Returns the first non-NULL argument (or NULL if all arguments are NULL). Requires two or more arguments.

Syntax
coalesce ( exp_list ) 

completeTuple

Identifies a cell location (intersection) based on the specified members, each of which must be from a different dimension. However, completeTuple () implicitly includes the default member from all dimensions not otherwise specified in the arguments, rather than the current member. The value of this cell can be obtained with the "value" function. Similar to tuple ().

Syntax
completeTuple ( member { , member } ) 

cousin

Returns the child member of "member2" with the same relative position as "member1" to its parent.

Syntax
cousin ( member1 , member2 ) 

current_date

Returns a date value representing the current date of the computer that the database software runs on.

Syntax
current_date 
Example
current_date 

Result: 2003-03-04

current_time

Returns a time with time zone value, representing the current time of the computer that runs the database software if the database supports this function. Otherwise, it represents the current time of the computer that runs IBM Cognos 8 software.

Syntax
current_time 
Example
current_time 

Result: 16:33:11+05:00

current_timestamp

Returns a datetime with time zone value, representing the current time of the computer that runs the database software if the database supports this function. Otherwise, it represents the current time of the computer that runs IBM Cognos 8 software.

Syntax
current_timestamp 
Example
current_timestamp 

Result: 2003-03-03 16:40:15.535000+05:00

currentMember

Returns the current member of the hierarchy during an iteration. If "hierarchy" is not present in the context in which the expression is being evaluated, its default member is assumed.

Syntax
currentMember ( hierarchy ) 

defaultMember

Returns the default member of "hierarchy".

Syntax
defaultMember ( hierarchy ) 

descendants

Returns the set of descendants of a member, or set of members, at a specified level (qualified name) or distance (integer 0..n) from the root. Multiple options may be specified (separated by a space) to determine which members are to be returned.

Syntax
descendants ( member | set_expr , level | distance [
, { self | before | beforewithmember | after } ] ) 
Example
descendants([national].[Line].[Line].[Line1]->:[PC].[Line (Root)].[Dishwashers],
2, SELF AFTER) 

Result: Result: AcmeWash MR AcmeWash AcmeWash HE

Notes

emptySet

Returns an empty member set for "hierarchy".

Syntax
emptySet ( hierarchy ) 

except

Returns the members of "set_exp1" that are not also in "set_exp2". Duplicates are retained only if the optional keyword ALL is supplied as the third argument.

Syntax
except ( set_exp1 , set_exp2 [,ALL] ) 

exp

Returns 'e' raised to the power of "numeric_exp". The constant 'e' is the base of the natural logarithm.

Syntax
exp ( numeric_exp ) 
Example
exp ( 2 ) 

Result: 7.389056

extract

Returns an integer representing the value of datepart (year, month, day, hour, minute, second) in "datetime_exp".

Syntax
extract ( datepart , datetime_exp ) 
Example 1
extract ( year , 2003-03-03 16:40:15.535 ) 

Result: 2003

Example 2
extract ( hour , 2003-03-03 16:40:15.535 ) 

Result: 16

filter

Returns the set resulting from filtering a specified set based on the boolean condition. Each member is included in the result if and only if the corresponding value of "boolean_exp" is true.

Syntax
filter ( set_exp , boolean_exp ) 

firstChild

Returns the first child of a member.

Syntax
firstChild ( member) 

firstSibling

Returns the first child of the parent of a member.

Syntax
firstSibling ( member ) 

floor

Returns the largest integer less than or equal to "numeric_exp".

Syntax
floor ( numeric_exp ) 
Example 1
floor ( 3.22 ) 

Result: 3

Example 2
floor ( -1.23 ) 

Result: -2

generate

Evaluates "set_exp2" for each member of "set_exp1" and joins the resulting sets by union. If "ALL" is specified, duplicates in the result are retained.

Syntax
generate ( set_exp1 , set_exp2 [ , ALL ] ) 

head

Returns the first "index_exp" elements of "set_exp". The default for "index_exp" is 1.

Syntax
head ( set_exp [ , index_exp ] ) 

hierarchize

Orders the members of a set in a hierarchy. Members in a level are sorted in their natural order. This is the default ordering of the members along a dimension when no other sort conditions are specified.

Syntax
hierarchize ( set_exp ) 

hierarchy

Returns the hierarchy that contains the specified level, member, or member set.

Syntax
hierarchy ( level | member | set_exp ) 

intersect

Returns the intersection of "set_exp1" and "set_exp2". The result retains duplicates only when the optional keyword "ALL" is supplied as the third argument.

Syntax
intersect ( set_exp1 , set_exp2 [ , ALL ] ) 

item

Returns a member from a specified location within a set. The index into the set is zero based.

Syntax
item ( set_exp , index ) 

lag

Returns the sibling member that is a specified number of positions prior to a specified member.

Syntax
lag ( member , index_exp ) 

lastChild

Returns the last child of a specified member.

Syntax
lastChild ( member ) 

lastPeriods

Returns the set of members from the same level that ends with the specified member. The number of members returned is the absolute value of "integer_exp". If "integer_exp" is negative, members following and including the specified member are returned. Typically used with a time dimension.

Syntax
lastPeriods ( integer_exp , member ) 

lastSibling

Returns the last child of the parent of a specified member.

Syntax
lastSibling ( member ) 

lead

Returns the sibling member that is "index_exp" number of positions following a specified member.

Syntax
lead ( member , index_exp ) 

level

Returns the level of a member.

Syntax
level ( member ) 

levels

Returns the level in the hierarchy whose distance from the root is specified by "index".

Syntax
levels ( hierarchy , index ) 

linkMember

Returns the corresponding member in the specified level or hierarchy (of the same dimension). For level-based hierarchies, a level must be specified as the second argument and for parent-child hierarchies, a hierarchy must be specified. An exception is thrown when the second parameter does not resolve to a hierarchy of the dimension that the member of the first parameter belongs to. Note that calculated members are not supported as the first argument.

Syntax
linkMember ( member , level | hierarchy ) 

ln

Returns the natural logarithm of the "numeric_exp".

Syntax
ln ( numeric_exp ) 
Example
ln ( 4 )  

Result: 1.38629

localtime

Returns a time value, representing the current time of the computer that runs the database software.

Syntax
localtime 
Example
localtime 

Result: 16:33:11

localtimestamp

Returns a datetime value, representing the current timestamp of the computer that runs the database software.

Syntax
localtimestamp 
Example
localtimestamp 

Result: 2003-03-03 16:40:15.535000

lower

Returns "string_exp" with all uppercase characters shifted to lowercase.

Syntax
lower ( string_exp ) 
Example
lower ( 'ABCDEF' ) 

Result: 'abcdef'

member

Defines a member based on the specified expression in the specified hierarchy. "String1" is used to identify the member created by this function. It must be unique in the query and must be different from any other member in the same hierarchy. "String2" is used as the caption of the member; if it is absent, the caption is empty. To ensure predictable results, it is recommended to supply the hierarchy parameter. Note: All calculations used as grouping items, whose sibling items are other calculations or member sets, should be explicitly assigned to a hierarchy using this function. The results are not predictable otherwise. The only exception is where the calculation involves only members of the same hierarchy as the siblings. In this case, the calculation is assumed to belong to that hierarchy.

Syntax
member ( value_exp [ , string1 [ , string2 [ , hierarchy
] ] ] ) 

members

Returns the set of members in a hierarchy or level. In the case of a hierarchy, the order of the members in the result is not guaranteed. If a predictable order is required, an explicit ordering function (such as hierarchize) must be used.

Syntax
members ( hierarchy | level ) 

mod

Returns the remainder (modulus) of "integer_exp1" divided by "integer_exp2". "Integer_exp2" must not be zero or an exception condition is raised.

Syntax
mod ( integer_exp1, integer_exp2 ) 
Example
mod ( 20 , 3 ) 

Result: 2

nestedSet

Returns the set of members of "set_exp2" evaluated in the context of the current member of "set_exp1".

Syntax
nestedSet ( set_exp1 , set_exp2 ) 

nextMember

Returns the next member in the level to which "member" exists.

Syntax
nextMember ( member ) 

octet_length

Returns the number of bytes in "string_exp".

Syntax
octet_length ( string_exp ) 
Example 1
octet_length ( 'ABCDEF' ) 

Result: 6

Example 2
octet_length ( '' ) 

Result: 0

openingPeriod

Returns the first sibling member among the descendants of a member at a specified level. Typically used with a time dimension.

Syntax
openingPeriod ( level [ , member ] ) 

order

Arranges members of a specified set, as determined from the set of values created by evaluating "value_exp" for each value of the set, and modified by the third parameter. There are two varieties of order: hierarchized (ASC or DESC) and non-hierarchized (BASC or BDESC, where B stands for "break hierarchy"). The hierarchized ordering first arranges members according to their position in the hierarchy. It then orders the children of each member according to "value_exp". The non-hierarchized ordering arranges members in the set without regard to the hierarchy. In the absence of an explicit specification, ASC is the default.

Syntax
order ( set_exp , value_exp [ , ASC | DESC | BASC | BDESC
] ) 

ordinal

Returns the zero-based ordinal value (distance from the root level) of the specified level.

Syntax
ordinal ( level ) 

parallelPeriod

Returns a member from a prior period in the same relative position as a specified member. This function is similar to the "Cousin" function, but is more closely related to time series. It takes the ancestor of "member" at "level" (called "ancestor") and the sibling of "ancestor" that lags by "int_exp" positions, and returns the parallel period of "member" among the descendants of that sibling. When unspecified, "int_exp" defaults to 1 and "member" defaults to the current member.

Syntax
parallelPeriod ( level [ , int_exp [ , member ] ] ) 

parent

Returns the member that is the parent of "member" or "measure".

Syntax
parent ( member | measure ) 

periodsToDate

Returns a set of sibling members from the same level as a given member, as constrained by "level". It locates the ancestor of "member" at "level", and returns that ancestor's descendants at the same level as "member" (up to and including "member"). Typically used with a time dimension.

Syntax
periodsToDate ( level , member ) 

position

Returns the integer value representing the starting position of "string_exp1" in "string_exp2" or 0 when the "string_exp1" is not found.

Syntax
position ( string_exp1 , string_exp2 ) 
Example 1
position ( 'C' , 'ABCDEF' ) 

Result: 3

Example 2
position ( 'H' , 'ABCDEF' ) 

Result: 0

power

Returns "numeric_exp1" raised to the power "numeric_exp2". If "numeric_exp1" is negative then "numeric_exp2" must result in an integer value.

Syntax
power ( numeric_exp1, numeric_exp2 ) 
Example
power ( 3 , 2 ) 

Result: 9

prevMember

Returns the member that immediately precedes the specified member in the same level.

Syntax
prevMember ( member ) 

roleValue

Returns the value of the attribute that is associated with the role whose name is specified by "string" within the specified context. The second argument is optional only in a number of limited circumstances, where it can be derived from another context. Applications can be made portable across different data sources and models by accessing attributes by role, rather than by query item ID. (For dimensionally modelled relational data sources, assignment of roles is the modeller's responsibility.) Intrinsic roles that are defined for members of all data source types include: '_businessKey', '_memberCaption', '_memberDescription', '_memberUniqueName'.

Syntax
roleValue ( string [ , member | set_exp ] ) 
Example
roleValue ( '_memberCaption', [Sales].[Product].[Product].[Product line]->[all].[1]
) 

Result: Camping Equipment

rootMember

Returns the root member of a single-root hierarchy.

Syntax
rootMember ( hierarchy ) 

rootMembers

Returns the root members of a hierarchy.

Syntax
rootMembers ( hierarchy ) 

set

Returns the list of members defined in the expression. The members must belong to the same hierarchy.

Syntax
set ( member { , member } ) 

siblings

Returns the children of the parent of the specified member.

Syntax
siblings ( member ) 

sqrt

Returns the square root of "numeric_exp". "Numeric_exp" must be non-negative.

Syntax
sqrt ( numeric_exp ) 
Example
sqrt ( 9 ) 

Result: 3

subset

Returns a subset of members from a specified set starting at "index_exp1" from the beginning. If the count "index_exp2" is specified, that many members are returned (if available). Otherwise, all remaining members are returned.

Syntax
subset ( set_exp, index_exp1 [ , index_exp2 ] ) 

substring

Returns the substring of "string_exp" that starts at position "integer_exp1" for "integer_exp2" characters or to the end of "string_exp" if "integer_exp2" is omitted. The first character in "string_exp" is at position 1.

Syntax
substring ( string_exp , integer_exp1 [ , integer_exp2
] ) 
Example
substring ( 'abdefg', 3, 2) 

Result: 'de'

tail

Returns the last "index_exp" elements of "set exp". The default for "index_exp" is 1.

Syntax
tail ( set_exp [ , index_exp ] ) 

topCount

Sorts a set according to the values of "numeric_exp" evaluated at each of the members of "set_exp" and returns the top "index_exp" members.

Syntax
topCount ( set_exp , index_exp , numeric_exp ) 

topPercent

Sorts "numeric_exp2", evaluated at the corresponding members of "set_exp", and picks up the topmost elements whose cumulative total is at least "numeric_exp1" percent of the total.

Syntax
topPercent ( set_exp , numeric_exp1, numeric_exp2 ) 

topSum

Sorts "numeric_exp2", evaluated at the corresponding members of "set_exp", and picks up the topmost elements whose cumulative total is at least "numeric_exp1".

Syntax
topSum ( set_exp , numeric_exp1 , numeric_exp2 ) 

trim

Returns "string_exp" trimmed of leading and trailing blanks or trimmed of a certain character specified in "match_character_exp". "BOTH" is implicit when the first argument is not stated and blank is implicit when the second argument is not stated.

Syntax
trim ( [ [ TRAILING | LEADING | BOTH ] [ match_character_exp
] , ] string_exp ) 
Example 1
trim ( TRAILING 'A' , 'ABCDEFA' ) 

Result: 'ABCDEF'

Example 2
trim ( BOTH ' ABCDEF ' ) 

Result: 'ABCDEF'

tuple

Identifies a cell location (intersection) based on the specified members, each of which must be from a different dimension. Implicitly includes the current member from all dimensions not otherwise specified in the arguments. The current member of any dimension not specified in the evaluating context is assumed to be the default member of that dimension. The value of this cell can be obtained with the "value" function.

Syntax
tuple (  member { , member } ) 

union

Returns the union of "set_exp1" and "set_exp2". The result retains duplicates only when the optional keyword "ALL" is supplied as the third argument.

Syntax
union ( set_exp1 , set_exp2 [ , ALL ] ) 

unique

Removes all duplicates from the specified set. The remaining members retain their original order.

Syntax
unique ( set_expr ) 

upper

Returns "string_exp" with all lowercase characters shifted to uppercase.

Syntax
upper ( string_exp ) 
Example
upper ( 'abcdef' ) 

Result: 'ABCDEF'

value

Returns the value of the cell identified by a "tuple". Note that the default member of the Measures dimension is the Default Measure.

Syntax
value ( tuple ) 

DB2

ascii

Returns the ASCII code value of the leftmost character of the argument as an integer.

Syntax
ascii ( string_exp ) 

ceiling

Returns the smallest integer greater than or equal to "numeric_exp".

Syntax
ceiling ( numeric_exp ) 

char

Returns a string representation of a date/time value or a decimal number.

Syntax
char ( exp ) 

chr

Returns the character that has the ASCII code value specified by "integer_exp". "Integer_exp" should be between 0 and 255.

Syntax
chr ( integer_exp ) 

concat

Returns a string that is the result of concatenating "string_exp1" with "string_exp2".

Syntax
concat ( string_exp1, string_exp2 ) 

date

Returns a date from a single input value. "Exp" can be a string or integer representation of a date.

Syntax
date ( exp ) 

day

Returns the day of the month (1-31) from "date_exp". "Date_exp" can be a date value or a string representation of a date.

Syntax
day ( date_exp ) 

dayname

Returns a character string containing the data source_specific name of the day (for example, Sunday through Saturday or Sun. through Sat. for a data source that uses English, or Sonntag through Samstag for a data source that uses German) for the day portion of "date_exp". "Date_exp" can be a date value or a string representation of a date.

Syntax
dayname ( date_exp ) 

dayofweek

Returns the day of the week in "date_exp" as an integer in the range 1 to 7, where 1 represents Sunday. "Date_exp" can be a date value or a string representation of a date.

Syntax
dayofweek ( date_exp ) 

dayofweek_iso

Returns the day of the week in "date_exp" as an integer in the range 1 to 7, where 1 represents Monday. "Date_exp" can be a date value or a string representation of a date.

Syntax
dayofweek_iso ( date_exp ) 

dayofyear

Returns the day of the year in "date_exp" as an integer in the range 1 to 366. "Date_exp" can be a date value or a string representation of a date.

Syntax
dayofyear ( date_exp ) 

days

Returns an integer representation of a date. "Exp" can be a date value or a string representation of a date.

Syntax
days ( exp ) 

dec

Returns the decimal representation of "string_exp1" with precision "numeric_exp1", scale "numeric_exp2" and decimal character "string_exp2". "String_exp1" must be formatted as an SQL Integer or Decimal constant.

Syntax
dec ( string_exp1 [ , numeric_exp1 [ , numeric_exp2 [
, string_exp2 ] ] ] ) 

decimal

Returns the decimal representation of "string_exp1" with precision "numeric_exp1", scale "numeric_exp2" and decimal character "string_exp2". "String_exp1" must be formatted as an SQL Integer or Decimal constant.

Syntax
decimal ( string_exp1 [ , numeric_exp1 [ , numeric_exp2
[ , string_exp2 ] ] ] ) 

difference

Returns an integer value representing the difference between the values returned by the data source_specific soundex function for "string_exp1" and "string_exp2". The value returned ranges from 0 to 4, with 4 indicating the best match. Note that 4 does not mean that the strings are equal.

Syntax
difference ( string_exp1, string_exp2 ) 

digits

Returns the character string representation of a non-floating point number.

Syntax
digits ( numeric_exp ) 

double

Returns the floating-point representation of an expression. "Exp" can either be a numeric or string expression.

Syntax
double ( exp ) 

event_mon_state

Returns the operational state of a particular state monitor.

Syntax
event_mon_state ( string_exp ) 

float

Returns the floating-point representation of a number.

Syntax
float ( numeric_exp ) 

hex

Returns the hexadecimal representation of a value.

Syntax
hex ( exp ) 

hour

Returns the hour, an integer from 0 (midnight) to 23 (11:00 pm), from "time_exp". "Time_exp" can be a time value or a string representation of a time.

Syntax
hour ( time_exp ) 

insert

Returns a string where "integer_exp2" characters have been deleted from "string_exp1" beginning at "integer_exp1" and where "string_exp2" has been inserted into "string_exp1" at start. The first character in the string is at position 1.

Syntax
insert ( string_exp1, integer_exp1, integer_exp2, string_exp2
) 

integer

Returns the integer representation of an expression. "Exp" can be a numeric value or a string representation of a number.

Syntax
integer ( exp ) 

int

Returns the integer representation of an expression. "Exp" can be a numeric value or a string representation of a number.

Syntax
int ( exp ) 

julian_day

Returns an integer value representing the number of days from January 1, 4712 BC (the start of the Julian date calendar) to the date value specified in "exp". "Exp" can be a date value or a string representation of a date.

Syntax
julian_day ( exp ) 

lcase

Returns "string_exp" with all uppercase characters shifted to lowercase.

Syntax
lcase ( string_exp ) 

left

Returns the leftmost "integer_exp" characters of "string_exp".

Syntax
left ( string_exp, integer_exp ) 

length

Returns the length of the operand in bytes. Exception: double byte string types return the length in characters.

Syntax
length ( exp ) 

locate

Returns the starting position of the first occurrence of "string_exp1" within "string_exp2". The search starts at position start "integer_exp" of "string_exp2". The first character in a string is at position 1. If "string_exp1" is not found, zero is returned.

Syntax
locate ( string_exp1, string_exp2 [ , integer_exp ] ) 

long_varchar

Returns a long string.

Syntax
long_varchar ( string_exp ) 

ltrim

Returns "string_exp" with leading spaces removed.

Syntax
ltrim ( string_exp ) 

microsecond

Returns the microsecond (time-unit) part of a value. "Exp" can be a timestamp or a string representation of a timestamp.

Syntax
microsecond ( exp ) 

midnight_seconds

Returns an integer value in the range 0 to 86400 representing the number of seconds between midnight and time value specified in the argument. "Exp" can be a time value, a timestamp or a string representation of a time.

Syntax
midnight_seconds ( exp ) 

minute

Returns the minute (an integer from 0-59) from "time_exp". "Time_exp" can be a time value, a timestamp, or a string representation of a time.

Syntax
minute ( time_exp ) 

month

Returns the month (an integer from 1-12) from "date_exp".

Syntax
month ( date_exp ) 

monthname

Returns a character string containing the data source_specific name of the month (for example, January through December or Jan. through Dec. for an English data source, or Januar through Dezember for a German data source) for the month portion of "date_exp".

Syntax
monthname ( date_exp ) 

quarter

Returns the quarter in "date_exp" as a number in the range 1 to 4, where 1 represents January 1 through March 31.

Syntax
quarter ( date_exp ) 

radians

Returns the number of radians converted from "numeric_exp" degrees.

Syntax
radians ( numeric_exp ) 

repeat

Returns a string consisting of "string_exp" repeated "integer_exp" times.

Syntax
repeat ( string_exp, integer_exp ) 

replace

Replaces all occurrences of "string_exp2" in "string_exp1" with "string_exp3".

Syntax
replace ( string_exp1, string_exp2, string_exp3 ) 

right

Returns the rightmost "integer_exp" characters of "string_exp".

Syntax
right ( string_exp, integer_exp ) 

round

Returns "numeric_exp" rounded to "integer_exp" places to the right of the decimal point. If "integer_exp" is negative, "numeric_exp" is rounded to the nearest absolute value "integer_exp" places to the left of the decimal point, e.g., round-near (125, -1) rounds to 130.

Syntax
round ( numeric_exp, integer_exp ) 

rtrim

Returns "string_exp" with trailing spaces removed.

Syntax
rtrim ( string_exp ) 

second

Returns the second (an integer from 0-59) from "time_exp".

Syntax
second ( time_exp ) 

sign

Returns an indicator of the sign of "numeric_exp": +1 if "numeric_exp" is positive, 0 if zero, or -1 if negative.

Syntax
sign ( numeric_exp ) 

smallint

Returns the small integer representation of a number.

Syntax
smallint ( exp ) 

soundex

Returns a 4 character string code obtained by systematically abbreviating words and names in "string_exp" according to phonetics. Can be used to determine if two strings sound the same, e.g., does sound-of ('SMITH') = sound-of ('SMYTH').

Syntax
soundex ( string_exp ) 

space

Returns a string consisting of "integer_exp" spaces.

Syntax
space ( integer_exp ) 

substr

Returns the substring of "string_exp" that starts at position "integer_exp1" for "integer_exp2" characters. The first character in "string_exp" is at position 1.

Syntax
substr ( string_exp, integer_exp1 [ , integer_exp2 ]
) 

table_name

Returns an unqualified name of a table or view based on the object name in "string_exp1" and the schema name given in "string_exp2". It is used to resolve aliases.

Syntax
table_name ( string_exp1 [ , string_exp2 ] ) 

table_schema

Returns the schema name portion of the two part table or view name based on the object name in "string_exp1" and the schema name in "string_exp2". It is used to resolve aliases.

Syntax
table_schema ( string_exp1 [ , string_exp2 ] ) 

time

Returns a time from a value.

Syntax
time ( exp ) 

timestamp

Returns a timestamp from a value or a pair of values. "Exp1' must represent a date value, and "exp2" must represent a time value.

Syntax
timestamp ( exp1 [ , exp2 ] ) 

timestamp_iso

Returns a datetime in the ISO format (yyyy-mm-dd hh:mm:ss.nnnnnn) converted from the IBM format (yyyy-mm-dd-hh.mm.ss.nnnnnn). If "exp" is a time, it inserts the value of the CURRENT DATE for the date elements and zero for the fractional time element.

Syntax
timestamp_iso ( exp ) 

timestampdiff

Returns an estimated number of intervals of type "exp1" based on the difference between two timestamps. "Exp2" is the result of subtracting two timestamp types and converting the result to CHAR. Valid values of "exp1" are: 1 Fractions of a second; 2 Seconds; 4 Minutes; 8 Hours; 16 Days; 32 Weeks; 64 Months; 128 Quarters; 256 Years.

Syntax
timestampdiff ( exp1, exp2 ) 

to_char

Returns the string representation of a timestamp with the format of "string_exp".

Syntax
to_char ( timestamp_exp , string_exp ) 

translate

Returns "string_exp1" in which characters from "string_exp3" are translated to the equivalent characters in "string_exp2". "String_exp4" is a single character that is used to pad "string_exp2" if it is shorter than "string_exp3". If only "string_exp1" is present, then this function translates it to uppercase characters.

Syntax
translate ( string_exp1 [ , string_exp2, string_exp3
[ , string_exp4 ] ] ) 

trunc

Returns "numeric_exp1" truncated to "numeric_exp2" places to the RIGHT of the decimal point. If "numeric_exp2" is negative, "numeric_exp1" is truncated to the absolute value of "numeric_exp2" places to the LEFT of the decimal point.

Syntax
trunc ( numeric_exp1, numeric_exp2 ) 

truncate

Returns "numeric_exp1" truncated to "numeric_exp2" places to the RIGHT of the decimal point. If "numeric_exp2" is negative, "numeric_exp1" is truncated to the absolute value of "numeric_exp2" places to the LEFT of the decimal point.

Syntax
truncate ( numeric_exp1, numeric_exp2 ) 

ucase

Returns "string_exp" with all lowercase characters shifted to uppercase.

Syntax
ucase ( string_exp ) 

value

Returns the first non-null argument (or null if all arguments are null). The Value function takes two or more arguments.

Syntax
value ( exp_list ) 

varchar

Returns a VARCHAR representation of exp, with length numeric_exp.

Syntax
varchar ( exp [ , numeric_exp ] ) 

week

Returns the week of the year in "date_exp" as an integer value in the range 1 to 53.

Syntax
week ( date_exp ) 

year

Returns the year from "date_exp".

Syntax
year ( date_exp ) 

DB2 Cast

cast_char

Returns the first "numeric_exp" characters of the value of "exp" cast as a string. The whole string is returned when the second argument is not specified.

Syntax
cast_char ( exp [ , numeric_exp ] ) 
cast_date

Returns the value of "exp" cast as a date.

Syntax
cast_date ( exp ) 
cast_decimal

Returns the value of "exp" cast as a decimal with the precision of "numeric_exp1" and scale of "numeric_exp2".

Syntax
cast_decimal ( exp [ , numeric_exp1, numeric_exp2 ] ) 
cast_double_precision

Returns the value of "exp" cast as a double.

Syntax
cast_double_precision ( exp ) 
cast_float

Returns the value of "exp" cast as a float.

Syntax
cast_float ( exp ) 
cast_integer

Returns the value of "exp" cast as a integer.

Syntax
cast_integer ( exp ) 
cast_longvarchar

Returns the value of "string_exp" cast as a longvarchar.

Syntax
cast_longvarchar ( string_exp ) 
cast_smallint

Returns the value of "exp" cast as a smallint.

Syntax
cast_smallint ( exp ) 
cast_time

Returns the value of "string_exp" cast as a time value.

Syntax
cast_time ( string_exp ) 
cast_timestamp

Returns the value of "exp" cast as a datetime.

Syntax
cast_timestamp ( exp ) 
cast_varchar

Returns the value of "exp" cast as a varchar with length "integer_exp".

Syntax
cast_varchar ( exp, integer_exp ) 

DB2 Math

log

Returns the natural logarithm of "numeric_exp".

Syntax
log ( numeric_exp ) 
log10

Returns the base ten logarithm of "numeric_exp".

Syntax
log10 ( numeric_exp ) 
rand

Generates a random number using "integer_exp" as a seed value.

Syntax
rand ( integer_exp ) 

DB2 Trigonometry

acos

Returns the arccosine of "numeric_exp" in radians. The arccosine is the angle whose cosine is "numeric_exp".

Syntax
acos ( numeric_exp ) 
asin

Returns the arcsine of "numeric_exp" in radians. The arcsine is the angle whose sine is "numeric_exp".

Syntax
asin ( numeric_exp ) 
atan

Returns the arctangent of "numeric_exp" in radians. The arctangent is the angle whose tangent is "numeric_exp".

Syntax
atan ( numeric_exp ) 
atanh

Returns the hyperbolic arctangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
atanh (numeric_exp ) 
atan2

Returns the arctangent of the x and y coordinates specified by "numeric_exp1" and "numeric_exp2", respectively, in radians. The arctangent is the angle whose tangent is "numeric_exp2" / "numeric_exp1".

Syntax
atan2 ( numeric_exp1, numeric_exp2 ) 
cos

Returns the cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cos ( numeric_exp ) 
cosh

Returns the hyperbolic cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cosh ( numeric_exp ) 
cot

Returns the cotangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cot ( numeric_exp ) 
degrees

Returns "numeric_exp" radians converted to degrees.

Syntax
degrees ( numeric_exp ) 
sin

Returns the sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sin ( numeric_exp ) 
sinh

Returns the hyperbolic sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sinh ( numeric_exp ) 
tan

Returns the tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tan ( numeric_exp ) 
tanh

Returns the hyperbolic tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tanh ( numeric_exp ) 

Informix

cardinality

Returns the number of elements in a collection column (SET, MULTISET, LIST).

Syntax
cardinality ( string_exp ) 

char_length

Returns the number of logical characters (which can be distinct from the number of bytes in some East Asian locales) in "string_exp".

Syntax
char_length ( string_exp ) 

concat

Returns a string that is the result of concatenating "string_exp1" to "string_exp2".

Syntax
concat ( string_exp1, string_exp2 ) 

date

Returns the date value of "string_exp" or "date_exp" or "int_exp".

Syntax
date ( string_exp | date_exp | int_exp ) 

day

Returns an integer that represents the day of the month.

Syntax
day ( date_exp ) 

extend

Adjusts the precision of a DATETIME or DATE expression. The expression cannot be a quoted string representation of a DATE value. If you do not specify first and last qualifiers, the default qualifiers are YEAR TO FRACTION(3). If the expression contains fields that are not specified by the qualifiers, the unwanted fields are discarded. If the first qualifier specifies a larger (that is, more significant) field than what exists in the expression, the new fields are filled in with values returned by the CURRENT function. If the last qualifier specifies a smaller field (that is, less significant) than what exists in the expression, the new fields are filled in with constant values. A missing MONTH or DAY field is filled in with 1, and the missing HOUR to FRACTION fields are filled in with 0.

Syntax
extend ( date_exp , ' { ' YEAR TO SECOND ' } ' ) 
Example
EXTEND (some_date_column , {YEAR TO SECOND} ) 

hex

Returns the hexadecimal encoding of "integer_exp".

Syntax
hex ( integer_exp ) 

initcap

Returns "string_exp", with the first letter of each word in uppercase and all other letters in lowercase. A word begins after any character other than a letter. Thus, in addition to a blank space, symbols such as commas, periods, colons, and so on, introduce a new word.

Syntax
initcap ( string_exp ) 

length

Returns the number of bytes in "string_exp", not including any trailing blank spaces. For BYTE or TEXT "string_exp", LENGTH returns the full number of bytes, including any trailing blank spaces.

Syntax
length ( string_exp ) 

lpad

Returns a copy of "string_exp1" that is left-padded by "string_exp2" to the total number of characters specified by "integer_exp". The sequence of "string_exp2" occurs as many times as necessary to make the return string the length specified by "integer_exp".

Syntax
lpad ( string_exp1, integer_exp, string_exp2 ) 

mdy

Returns a type DATE value with three expressions that evaluate to integers that represent the month (integer_exp1), day (integer_exp2), and year (integer_exp3).

Syntax
mdy ( integer_exp1, integer_exp2, integer_exp3 ) 

month

Returns an integer corresponding to the month portion of "date_exp".

Syntax
month ( date_exp ) 

nvl

Returns the value of "exp1" if "exp1" is not NULL. If "exp1" is NULL, then the value of "exp2" is returned.

Syntax
nvl ( exp1, exp2 ) 

octet_length

Returns the number of bytes in "string_exp", including any trailing spaces.

Syntax
octet_length ( string_exp ) 

replace

Returns a copy of "string_exp1" in which every occurrence of "string_exp2" is replaced by "string_exp3". If you omit the "string_exp3" option, every occurrence of "string_exp2" is omitted from the return string.

Syntax
replace ( string_exp1, string_exp2 [ , string_exp3 ]
) 

round

Returns the rounded value of "numeric_exp". If you omit "integer_exp", the value is rounded to zero digits or to the units place. The digit range of 32 (+ and -) refers to the entire decimal value.

Syntax
round ( numeric_exp [ , integer_exp ] ) 

rpad

Returns a copy of "string_exp1" that is right-padded by "string_exp2" to the total number of characters specified by "integer_exp". The sequence of "string_exp2" occurs as many times as necessary to make the return string the length specified by "integer_exp".

Syntax
rpad ( string_exp1, integer_exp, string_exp2 ) 

substr

Returns the substring of "string_exp" that starts at position "integer_exp1". The first character in "string_exp" is at position 1. "Integer_exp2" can be used to select fewer characters, by default it selects to the end of the string.

Syntax
substr ( string_exp, integer_exp1 [ , integer_exp2 ]
) 

to_char

Returns the character string "date_exp" with the specified "string_exp" formatting. You can use this function only with built-in data types.

Syntax
to_char ( date_exp, string_exp ) 

to_date

Returns "string_exp1" as a date according to the date format you specify in the "string_exp2" parameter. If "string_exp1" is NULL, then a NULL value is returned.

Syntax
to_date ( string_exp1, string_exp2 )  

trunc

Returns the truncated value of "numeric_exp". If you omit "integer_exp", the value is truncated to zero digits or to the unit’s place. The digit limitation of 32 (+ and -) refers to the entire decimal value.

Syntax
trunc ( numeric_exp [ , integer_exp ] ) 

weekday

Returns an integer that represents the day of the week; zero (0) represents Sunday, one (1) represents Monday, and so on.

Syntax
weekday ( date_exp ) 

year

Returns a four-digit integer that represents the year.

Syntax
year ( date_exp ) 

Informix Math

log10

Returns the log of "numeric_exp" to base 10.

Syntax
log10 ( numeric_exp ) 
logn

Returns the natural logarithm of "numeric_exp".

Syntax
logn ( numeric_exp ) 
root

Returns the root value of "numeric_exp". Requires at least one numeric argument (the radians argument). If only "numeric_exp1" is supplied, 2 is used as a default value for "numeric_exp2"; 0 cannot be used as the value of "numeric_exp2".

Syntax
root ( numeric_exp1[ , numeric_exp2 ] ) 

Informix Trigonometry

acos

Returns the arccosine of "numeric_exp" in radians. The arccosine is the angle whose cosine is "numeric_exp".

Syntax
acos ( numeric_exp ) 
asin

Returns the arcsine of "numeric_exp" in radians. The arcsine is the angle whose sine is "numeric_exp".

Syntax
asin ( numeric_exp ) 
atan

Returns the arctangent of "numeric_exp" in radians. The arctangent is the angle whose tangent is "numeric_exp".

Syntax
atan ( numeric_exp ) 
atan2

Returns the arctangent of the x and y coordinates specified by "numeric_exp1" and "numeric_exp2", respectively, in radians. The arctangent is the angle whose tangent is "numeric_exp1".

Syntax
atan2 ( numeric_exp1, numeric_exp2 ) 
cos

Returns the cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cos ( numeric_exp ) 
sin

Returns the sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sin ( numeric_exp ) 
tan

Returns the tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tan ( numeric_exp ) 

MS Access

ascii

Returns a number representing the ascii code value of the leftmost character of "string_exp".

Syntax
ascii(string_exp) 

ceiling

Returns the smallest integer greater than or equal to "numeric_exp".

Syntax
ceiling(numeric_exp) 

chr

Returns the character that has the ASCII code value specified by "integer_exp". "Integer_exp" should be between 0 and 255.

Syntax
chr(integer_exp) 

concat

Returns a string that is the result of concatenating "string_exp1" to "string_exp2".

Syntax
concat(string_exp1, string_exp2) 

curdate

Returns a date value representing the current date of the computer that the database software runs on.

Syntax
curdate() 

curtime

Returns a time value representing the current time of the computer that the database software runs on.

Syntax
curtime() 

dayname

Returns a character string containing the data source specific name of the day (for example, Sunday through Saturday or Sun. through Sat. for an English data source, or Sonntag through Samstag for a German data source) for the day portion of "date_exp".

Syntax
dayname(date_exp) 

dayofmonth

Returns the day of the month (1-31) from "date_exp". Returns the days field (a signed integer) from "interval_exp".

Syntax
dayofmonth(date_exp|interval_exp) 

dayofweek

Returns the day of the week in "date_exp" as an integer (1-7), where 1 represents Monday.

Syntax
dayofweek(date_exp) 

dayofyear

Returns the day of the year in "date_exp" as an integer (1-366).

Syntax
dayofyear(date_exp) 

hour

Returns the hour (an integer from 0 (midnight) to 23 (11:00 pm)) from "time_exp".

Syntax
hour(time_exp) 

instr

Searches "string_exp1" for the first occurrence of "string_exp2" and returns an integer specifying the position of "string_exp2". The optional argument "integer_exp1" sets the starting position for the search. If omitted, the search begins at the first character position of "string_exp1". The optional argument "integer_exp2" specifies the type of string comparison. "Integer_exp1" is required if "integer_exp2" is specified.

Syntax
instr ( [ integer_exp1 , ] string_exp1, string_exp2 [
, integer_exp2 ] ) 

lcase

Returns "string_exp" with all uppercase characters shifted to lowercase.

Syntax
lcase(string_exp) 

left

Returns the leftmost "integer_exp" characters of "string_exp".

Syntax
left(string_exp, integer_exp) 

length

Returns the number of characters in "string_exp", excluding trailing blanks and the string termination character.

Syntax
length(string_exp) 

locate

Returns the starting position of the first occurrence of "string_exp1" within "string_exp2". The search starts at position "integer_exp" of "string_exp2". The first character in a string is at position 1. If "string_exp1" is not found then zero is returned.

Syntax
locate(string_exp1, string_exp2 [ , integer_exp ] ) 

ltrim

Returns "string_exp" with leading spaces removed.

Syntax
ltrim(string_exp) 

minute

Returns the minute (an integer from 0-59) from "time_exp".

Syntax
minute(time_exp) 

month

Returns the month (an integer from 1-12) from "date_exp".

Syntax
month(date_exp) 

monthname

Returns a character string containing the data source specific name of the month (for example, January through December or Jan. through Dec. for an English data source, or Januar through Dezember for a German data source) for the month portion of "date_exp".

Syntax
monthname(date_exp) 

now

Returns a datetime value representing the current date and time of the computer that the database software runs on.

Syntax
now() 

position

Returns the starting position of "string_exp1" in "string_exp2". The first character in a string is at position 1.

Syntax
position(string_exp1, string_exp2) 

quarter

Returns the quarter in "date_exp" as a number (1-4), where 1 represents January 1 through March 31.

Syntax
quarter(date_exp) 

right

Returns the rightmost "integer_exp" characters of "string_exp".

Syntax
right(string_exp, integer_exp) 

round

Returns "numeric_exp" rounded to the nearest value "integer_exp" places right of the decimal point. If "integer_exp" is negative, "numeric_exp" is rounded to the nearest absolute value, "integer_exp" places to the left of the decimal point.

Syntax
round(numeric_exp, integer_exp) 

rtrim

Returns "string_exp" with trailing spaces removed.

Syntax
rtrim(string_exp) 

sign

Returns an indicator of the sign of "numeric_exp": +1 if positive, 0 if zero, or -1 if negative.

Syntax
sign(numeric_exp) 

space

Returns a string consisting of "integer_exp" spaces.

Syntax
space(integer_exp) 

substr

Returns the substring of "string_exp" that starts at position "integer_exp1" for "integer_exp2" characters. The first character in "string_exp" is at position 1.

Syntax
substr(string_exp, integer_exp1, integer_exp2) 

substring

Returns the substring of "string_exp" that starts at position "integer_exp1" for "integer_exp2" characters. The first character in "string_exp" is at position 1.

Syntax
substring(string_exp, integer_exp1, integer_exp2) 

truncate

Returns "string_exp" with trailing spaces removed.

Syntax
truncate(string_exp) 

ucase

Returns "string_exp" with all lowercase characters shifted to uppercase.

Syntax
ucase(string_exp) 

week

Returns the week of the year in "date_exp" as an integer value (1-53), where 1 represents the first week of the year.

Syntax
week(date_exp) 

year

Returns the year from "date_exp".

Syntax
year(date_exp) 

MS Access Cast

cast_decimal

Returns the value of "exp" cast as a decimal.

Syntax
cast_decimal(exp) 
cast_float

Returns the value of "exp" cast as a float.

Syntax
cast_float(exp) 
cast_integer

Returns the value of "exp" cast as an integer.

Syntax
cast_integer(exp) 
cast_numeric

Returns the value of "string_exp" cast as a numeric value.

Syntax
cast_numeric(string_exp) 
cast_real

Returns the value of "exp" cast as a real.

Syntax
cast_real(exp) 
cast_smallint

Returns the value of "exp" cast as a smallint.

Syntax
cast_smallint(exp) 
cast_varchar

Returns the value of "exp" cast as a varchar.

Syntax
cast_varchar(exp) 

MS Access Math

log

Returns the natural logarithm of "numeric_exp".

Syntax
log(numeric_exp) 
rand

Generates a random number using "integer_exp" as a seed value.

Syntax
rand(integer_exp) 

MS Access Trigonometry

atan

Returns the arctangent of "numeric_exp" in radians. The arctangent is the angle whose tangent is "numeric_exp".

Syntax
atan(numeric_exp) 
cos

Returns the cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cos(numeric_exp) 
sin

Returns the sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sin(numeric_exp) 
tan

Returns the tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tan(numeric_exp) 

Oracle

add_months

Returns the datetime resulting from adding "integer_exp" months to "date_exp".

Syntax
add_months ( date_exp, integer_exp ) 

ascii

Returns a number representing the ascii code value of the leftmost character of "string_exp", e.g. ascii('A') is 65.

Syntax
ascii ( string_exp ) 

ceil

Returns the smallest integer greater than or equal to "numeric_exp".

Syntax
ceil ( numeric_exp ) 

char_length

Returns the number of characters in "string_exp".

Syntax
char_length ( string_exp ) 

chr

Returns the character that has the ASCII code value specified by "integer_exp". "Integer_exp" should be between 0 and 255.

Syntax
chr ( integer_exp ) 

concat

Returns a string that is the result of concatenating "string_exp1" to "string_exp2".

Syntax
concat ( string_exp1, string_exp2 ) 

decode

Compares "expr" to each search value one by one. If "expr" is equal to a search, then it returns the corresponding result. If no match is found, it returns "default". If "default" is omitted, it returns null.

Syntax
decode ( expr , search , result [, search , result]...
[, default] ) 

dump

Returns internal representation of "expr" with the format of "numeric_exp1" starting from position "numeric_exp2" for "numeric_exp3".

Syntax
dump ( expr [ , numeric_exp1 [ , numeric_exp2 [ , numeric_exp3
] ] ] ) 

greatest

Returns the greatest value in "exp_list".

Syntax
greatest ( exp_list ) 

initcap

Returns "string_exp", with the first letter of each word in uppercase, all other letters in lowercase. Words are delimited by white space or characters that are not alphanumeric.

Syntax
initcap ( string_exp ) 

instr

Searches "string_exp1" starting at position "integer_exp1" for the "integer_exp2" occurance of "string_exp2". If "integer_exp1" is negative then the search is backwards from the end of "string_exp1". Returns an integer indicating the position of "string_exp2".

Syntax
instr ( string_exp1, string_exp2 [ , integer_exp1 [ ,
integer_exp2 ] ] ) 

instrb

Searches "string_exp1" starting at position "integer_exp1" for the "integer_exp2" occurance of "string_exp2". If "integer_exp1" is negative then the search is backwards from the end of "string_exp1". The result returned indicates the position (byte number) where the search was found.

Syntax
instrb ( string_exp1, string_exp2 [ , integer_exp1 [
, integer_exp2 ] ] ) 

least

Returns the least value in "exp_list".

Syntax
least ( exp_list ) 

length

Returns the number of characters in "string_exp".

Syntax
length ( string_exp ) 

lengthb

Returns the number of bytes in "string_exp".

Syntax
lengthb ( string_exp ) 

lpad

Returns "string_exp1" padded to length "integer_exp" with occurrences of "string_exp2". If "string_exp1" is longer than "integer_exp", the appropriate portion of "string_exp1" is returned.

Syntax
lpad ( string_exp1, integer_exp [ , string_exp2 ] ) 

ltrim

Returns "string_exp1", with leading characters removed up to the first character not in "string_exp2", e.g. ltrim('xyxXxyAB', 'xy') returns 'XxyAB'.

Syntax
ltrim ( string_exp1 [ , string_exp2 ] ) 

months_between

Returns the number of months from "date_exp1" to "date_exp2". If "date_exp1" is later than "date_exp2" then the result will be a positive number. The days and time portion of the difference are ignored, i.e. the months are not rounded, except if "date_exp1" and "date_exp2" are the last days of a month.

Syntax
months_between ( date_exp1, date_exp2 ) 

new_time

Returns the datetime in timezone "new_tz" for "datetime_exp" in "old_tz" timezone. "Old_tz" and "new_tz" can be one of 'AST', 'ADT', 'BST', 'BDT', 'CST', 'CDT', 'EST', 'EDT', 'HST', 'HDT', 'MST', 'MDT', 'NST', 'PST', 'PDT', 'YST' or 'YDT'.

Syntax
new_time ( datetime_exp, old_tz, new_tz ) 

next_day

Returns the datetime of the first weekday named by "string_exp" that is later than "datetime_exp". The return value has the same hours, minutes, and seconds as "datetime_exp".

Syntax
next_day ( datetime_exp, string_exp ) 

nls_initcap

Returns "string_exp1" with the first letter of each word in uppercase, all other letters in lowercase. Words are delimited by white space or characters that are not alphanumeric. "String_exp2" specifies the sorting sequence.

Syntax
nls_initcap ( string_exp1 [ , string_exp2 ] ) 

nls_lower

Returns "string_exp1" with all letters in lowercase. "String_exp2" specifies the sorting sequence.

Syntax
nls_lower ( string_exp1 [ , string_exp2 ] ) 

nls_upper

Returns "string_exp1" with all letters in uppercase. "String_exp2" specifies the sorting sequence.

Syntax
nls_upper ( string_exp1 [ , string_exp2 ] ) 

nvl

Returns "exp" if not null, otherwise returns "constant". Valid for "numeric_exp", "string_exp", "date_exp", and "time_exp".

Syntax
nvl ( exp, constant ) 

replace

Replaces all occurrences of "string_exp2" in "string_exp1" with "string_exp3". If "string_exp3" is not specified then it replaces all occurrences with null (ie: removes all occurances of "string_exp2").

Syntax
replace ( string_exp1, string_exp2 [ , string_exp3 ]
) 

round

Returns "numeric_exp" rounded to the nearest value "integer_exp" places right of the decimal point. If "integer_exp" is negative, "numeric_exp" is rounded to the nearest absolute value "integer_exp" places to the left of the decimal point, e.g., round (125, -1) rounds to 130.

Syntax
round ( numeric_exp [ , integer_exp ] ) 

rpad

Returns "string_exp1" right-padded to length "integer_exp" with occurrences of "string_exp2". If "string_exp1" is longer than "integer_exp", the appropriate portion of "string_exp1" is returned. If "string_exp2" is not specified then spaces are used.

Syntax
rpad ( string_exp1, integer_exp [ , string_exp2 ] ) 

rtrim

Returns "string_exp1", with final characters removed after the last character not in "string_exp2", e.g. rtrim('ABxXxyx', 'xy') returns 'ABxX'. If "string_exp2" is not specified, the final space characters are removed.

Syntax
rtrim ( string_exp1 [ , string_exp2 ] ) 

sign

Returns an indicator of the sign of "numeric_exp": +1 if positive, 0 if zero, or -1 if negative.

Syntax
sign ( numeric_exp ) 

soundex

Returns a character string containing the phonetic representation of "string_exp".

Syntax
soundex ( string_exp ) 

substr

Returns the substring of "string_exp" that starts at position "integer_exp1". The first character in "string_exp" is at position 1. "Integer_exp2" can be used to select fewer characters; by default it selects characters to the end of the string.

Syntax
substr ( string_exp, integer_exp1 [ , integer_exp2 ]
) 

substrb

Returns the substring of "string_exp" that starts at position "numeric_exp1" expressed in bytes. The first byte in "string_exp" is at position 1. "Integer_exp2" can be used to select fewer bytes; by default it selects bytes to the end of the string.

Syntax
substrb ( string_exp, numeric_exp1 [ , numeric_exp2 ]
) 

{sysdate}

Returns a datetime value representing the current date and time of the computer that the database software runs on.

Syntax
{ sysdate } 

to_char

Returns the string representation of "exp" with the format of "string_exp". "Exp" can either be a date value or a numeric value.

Syntax
to_char ( exp [ , string_exp ] ) 

to_date

Converts "string_exp1" to a datetime value as specified by the format "string_exp2". "String_exp3" specifies the format elements. (e.g. language)

Syntax
to_date ( string_exp1 [ , string_exp2 [ , string_exp3
] ] ) 

to_number

Converts "string_exp1" to a numeric value as specified by the format "string_exp2". "String_exp3" specifies the format elements. (e.g. currency information)

Syntax
to_number ( string_exp1, string_exp2, string_exp3 ) 

translate

Returns "string_exp1", with all occurrences of each character in "string_exp2" replaced by its corresponding character in "string_exp3".

Syntax
translate ( string_exp1, string_exp2, string_exp3 ) 

trunc

Truncates "date_exp" using the format specified by "string_exp". For example, if "string_exp" is 'YEAR' then "date_exp" is truncated to the first day of the year.

Syntax
trunc ( date_exp, string_exp ) 

trunc

Truncates digits from "numeric_exp1" using "numeric_exp2" as the precision.

Syntax
trunc ( numeric_exp1, numeric_exp2 ) 

{user}

Returns the username of the current Oracle user.

Syntax
{ user } 

vsize

Returns the number of bytes in the internal representation of "exp". "Exp" must be a string expression.

Syntax
vsize ( exp ) 

Oracle Math

log

Returns the logarithm of "numeric_exp2" to the base "numeric_exp1".

Syntax
log ( numeric_exp1, numeric_exp2 ) 

Oracle Trigonometry

acos

Returns the arccosine of "numeric_exp" in radians. The arccosine is the angle whose cosine is "numeric_exp".

Syntax
acos ( numeric_exp ) 
asin

Returns the arcsine of "numeric_exp" in radians. The arcsine is the angle whose sine is "numeric_exp".

Syntax
asin ( numeric_exp ) 
atan

Returns the arctangent of "numeric_exp" in radians. The arctangent is the angle whose tangent is "numeric_exp".

Syntax
atan ( numeric_exp ) 
atan2

Returns the arctangent of the x and y coordinates specified by "numeric_exp1" and "numeric_exp2", respectively, in radians. The arctangent is the angle whose tangent is "numeric_exp2" / "numeric_exp1".

Syntax
atan2 ( numeric_exp1 ,numeric_exp2 ) 
cos

Returns the cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cos ( numeric_exp ) 
cosh

Returns the hyperbolic cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cosh ( numeric_exp ) 
sin

Returns the sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sin ( numeric_exp ) 
sinh

Returns the hyperbolic sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sinh ( numeric_exp ) 
tan

Returns the tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tan ( numeric_exp ) 
tanh

Returns the hyperbolic tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tanh ( numeric_exp ) 

Red Brick

ceil

Returns the smallest integer greater than or equal to "numeric_exp" or "string_exp". Note that "string_exp" must represent a valid numeric value.

Syntax
ceil ( numeric_exp | string_exp ) 

concat

Returns "string_exp1" concatenated with "string_exp2".

Syntax
concat ( string_exp1 , string_exp2 ) 

{current_user}

Returns the database username (authorization ID) of the current user.

Syntax
{ current_user } 

date

Returns a date value. "Exp" can be either characters or a timestamp.

Syntax
date ( exp ) 

dateadd

Adds an interval to a datetime value and returns a result that is the same datetime data type as that of "datetime_exp". The datepart refers to year, month, day, hour, minute, second. The interval must be an integer and "datetime_exp" can be date, time, or timestamp.

Syntax
dateadd ( { datepart }, interval, datetime_exp ) 

datediff

Determines the difference between two datetime expressions and returns an integer result in "datepart" units. "Datepart" refers to year, month, day, hour, minute, or second. "Datetime_exp1" and "datetime_exp2" can be dates, times, or timestamps.

Syntax
datediff ( { datepart }, datetime_exp1, datetime_exp2
) 

datename

Extracts the specified datepart component and returns its value as a character string. The datepart refers to year, month, day, hour, minute, or second. "Datetime_exp" can be a date, a time, or a timestamp.

Syntax
datename ( { datepart }, datetime_exp )  

dec

Converts a specified value to a decimal value and returns a value with the data type decimal (precision, scale). The default value of precision is 9. The default value of scale is 0.

Syntax
dec ( exp, [precision, scale] ) 

decimal

Converts a specified value to a decimal value and returns a value with the data type decimal (precision, scale). The default value of precision is 9. The default value of scale is 0.

Syntax
decimal ( exp, [precision, scale] ) 

decode

Compares and converts "exp" to another value. If "exp" matches the target, it is replaced, otherwise it is replaced by default or by NULL if no default is specified. The expressions can be any data type as long as they are all the same data type.

Syntax
decode ( exp, target, replacement [,default] ) 

float

Converts a specified value into a double-precision floating-point value.

Syntax
float ( numeric_exp ) 

ifnull

Tests "exp" for missing values and replaces each one with a specified value. If "exp" is NULL, "substitute" is returned, otherwise it returns the value of "exp". The expressions can be any data type as long as they are all the same data type.

Syntax
ifnull ( exp, substitute ) 

int

Converts "numeric_exp" into an integer value and returns an integer value. If the argument is NULL, it returns NULL.

Syntax
int ( numeric_exp ) 

integer

Converts "numeric_exp" into an integer value and returns an integer value. If the argument is NULL, it returns NULL.

Syntax
integer ( numeric_exp ) 

length

Returns an integer result specifying the number of characters in "string_exp". If "string_exp" is NULL, it returns NULL.

Syntax
length ( string_exp )  

lengthb

Returns an integer result specifying the number of bytes in "string_exp". If "string_exp" is NULL, it returns NULL.

Syntax
lengthb ( string_exp )  

ltrim

Removes leading blanks from "string_exp". If "string_exp" is NULL, it returns NULL.

Syntax
ltrim ( string_exp ) 

nullif

Returns NULL if both "exp1" and "exp2" have the same value. If they have different values, the value of "exp1" is returned. "Exp1" and "exp2" can be any data type as long as they are the same data type.

Syntax
nullif ( exp1, exp2 ) 

positionb

Returns an integer that is relative to the beginning byte position of "string_exp1" in "string_exp2". If "string_exp1" is not located, the result is 0. If "string_exp1" is of zero length, the result is 1. If "string_exp1" is NULL, an error message is returned. If "string_exp2" is NULL, the result is 0.

Syntax
positionb ( string_exp1, string_exp2 ) 

real

Returns a real value. If "numeric_exp" is NULL, it returns NULL.

Syntax
real ( numeric_exp ) 

round

Returns "numeric_exp" rounded to the nearest value "integer_exp" places to the right of the decimal point. If "integer_exp" is negative, "numeric_exp" is rounded to the nearest absolute value "integer_exp" places to the left of the decimal point, e.g., round (125, -1) rounds to 130.

Syntax
round ( numeric_exp, integer_exp ) 

rtrim

Removes trailing blanks from "string_exp". If "string_exp" is NULL, it returns NULL.

Syntax
rtrim ( string_exp ) 

sign

Determines the sign of "numeric_exp", and returns 1 for a positive value, –1 for a negative value, and 0 for zero.

Syntax
sign ( numeric_exp ) 

string

Converts numeric or datetime values to character strings. "Exp" can be either numeric or datetime.

Syntax
string ( exp [, length [, scale]] ) 

substr

Returns a substring of "string_exp" that begins at position "start_integer" and continues for "length_integer" characters. If "length_integer" is not specified, a substring from the start to the end of "string_exp" is returned.

Syntax
substr ( string_exp, start_integer, length_integer ) 

substrb

Returns a substring of "string_exp" that begins at position "start_integer" and continues for "length_integer" bytes. If "length_integer" is not specified, a substring from the start to the end of "string_exp" is returned.

Syntax
substrb ( string_exp, start_integer, length_integer ) 

time

Creates a time value from a character string or a time-stamp data type expression.

Syntax
time ( exp ) 

timestamp

Creates a time-stamp value from a character string.

Syntax
timestamp ( timestamp_exp ) 

timestamp

Creates a time-stamp value from "time_exp" and "date_exp". If either "time_exp" or "date_exp" is NULL, the resulting time-stamp expression is also NULL.

Syntax
timestamp ( date_exp, time_exp ) 

to_char

This function is a datetime scalar function that operates on a date, time, or timestamp data type and returns the character string specified by a given format.

Syntax
to_char ( source_date, format_str ) 

SQL Server

ascii

Returns a number representing the ascii code value of the leftmost character of "string_exp", e.g. ascii('A') is 65.

Syntax
ascii ( string_exp ) 

char

Returns the character that has the ASCII code value specified by "integer_exp". "Integer_exp" should be between 0 and 255. e.g. char(65) has the value 'A'.

Syntax
char ( integer_exp ) 

charindex

Searches "string_exp2" for the first occurrence of "string_exp1" and returns an integer. "Start_location" is the character position to start searching for "string_exp1" in "string_exp2". If "start_location" is not specified, is a negative number, or is zero, the search starts at the beginning of "string_exp2".

Syntax
charindex ( string_exp1, string_exp2 [ , start_location
]  ) 

{current_user}

Returns the name of the current user.

Syntax
{ current_user } 

datalength

Returns the length in bytes of "string_exp".

Syntax
datalength ( string_exp ) 

dateadd

Returns the date resulting from the addition of "integer_exp" units (indicated by datepart (day, month, year)) to "date_exp".

Syntax
dateadd ( {datepart}, integer_exp, date_exp ) 

datediff

Returns the number of units indicated by datepart (day, month, year) between "date_exp1" and "date_exp2".

Syntax
datediff ( {datepart}, date_exp1, date_exp2 ) 

datename

Returns part of a datetime, smalldatetime, date or time value as an ASCII string. Note that the "datepart" argument must be a keyword representing a datepart or its abbreviation recognized by Microsoft SQL Server and must be enclosed in curly brackets.

Syntax
datename ( ' { ' datepart ' } ' , date_exp ) 
Example
datename ( {mm}, 2000-01-01 ) 

Result: January.

datepart

Returns part of a datetime, smalldatetime, date or time value (for example, the month) as an integer. Note that the "datepart" argument must be a keyword representing a datepart or its abbreviation recognized by Microsoft SQL Server and must be enclosed in curly brackets.

Syntax
datepart ( ' { ' datepart ' } ' , date_exp ) 
Example
datepart ( {wk}, 2000-01-01 ) 

Result: 1 (first week of the year).

day

Returns the day portion of "date_exp". Same as extract (day from date_exp).

Syntax
day ( date_exp ) 

difference

Returns an integer value representing the difference between the values returned by the data source_specific soundex function for "string_exp1" and "string_exp2". The value returned ranges from 0 to 4, with 4 indicating the best match. Note that 4 does not mean that the strings are equal.

Syntax
difference ( string_exp1, string_exp2 ) 

getdate

Returns a datetime value representing the current date and time of the computer that the database software runs on.

Syntax
getdate () 

left

Returns the leftmost "integer_exp" characters of "string_exp".

Syntax
left ( string_exp, integer_exp ) 

ltrim

Returns "string_exp" with leading spaces removed.

Syntax
ltrim ( string_exp ) 

month

Returns the month portion of "date_exp". Same as extract (month from date_exp).

Syntax
month ( date_exp ) 

patindex

Returns an integer which represents the starting position of the first occurrence of "string_exp1" in the "string_exp2". Returns 0 if "string-exp1" is not found. The % wildcard character must precede and follow "string_exp1", except when searching for first or last characters.

Syntax
patindex ( string_exp1, string_exp2 ) 
Example
patindex ( '%nos%', 'Cognos' ) 

Result: 4

replace

Replaces all occurrences of "string_exp2" in "string_exp1" with "string_exp3".

Syntax
replace ( string_exp1 , string_exp2 , string_exp3 ) 

replicate

Returns a string consisting of "string_exp" repeated "integer_exp" times.

Syntax
replicate ( string_exp, integer_exp ) 

reverse

Returns "string_exp" in reverse order.

Syntax
reverse ( string_exp ) 

right

Returns the rightmost "integer_exp" characters of "string_exp".

Syntax
right ( string_exp, integer_exp ) 

round

Returns "numeric_exp" rounded to the nearest value "integer_exp" places to the right of the decimal point.

Syntax
round ( numeric_exp, integer_exp ) 

rtrim

Returns "string_exp" with trailing spaces removed.

Syntax
rtrim ( string_exp ) 

sign

Returns an indicator of the sign "numeric_exp": +1 if "numeric_exp" is positive, 0 if zero or -1 if negative.

Syntax
sign ( numeric_exp ) 

soundex

Returns a four character string representing the sound of the words in "string_exp".

Syntax
soundex ( string_exp ) 

space

Returns a string consisting of "integer_exp" spaces.

Syntax
space ( integer_exp ) 

str

Returns a string representation of "numeric_exp" where "integer_exp1" is the length of the string returned and "integer_exp2" is the number of decimal digits.

Syntax
str ( numeric_exp [ , integer_exp1 [ , integer_exp2 ]
] ) 

stuff

Returns a string where "integer_exp2" characters have been deleted from "string_exp1" beginning at "integer_exp1" and where "string_exp2" has been inserted into "string_exp1" at start. The first character in a string is at position 1.

Syntax
stuff ( string_exp1, integer_exp1, integer_exp2, string_exp2
) 

year

Returns the year portion of "date_exp". Same as extract (year from date_exp).

Syntax
year ( date_exp ) 

SQL Server Cast

cast_char

Returns the value of "exp" cast as a character. A limit of 30 characters is returned.

Syntax
cast_char ( exp ) 
cast_float

Returns the value "exp" cast as a float.

Syntax
cast_float ( exp ) 
cast_integer

Returns the value of "exp" cast as an integer.

Syntax
cast_integer ( exp ) 
cast_real

Returns the value of "exp" cast as a real.

Syntax
cast_real ( exp ) 
cast_smallint

Returns the value of "exp" cast as a small integer.

Syntax
cast_smallint ( exp ) 

SQL Server Math

log

Returns the natural logarithm of "numeric_exp".

Syntax
log ( numeric_exp ) 
log10

Returns the base ten logarithm of "numeric_exp".

Syntax
log10 ( numeric_exp ) 
pi

Returns the constant value of pi as a floating point value.

Syntax
pi () 
rand

Generates a random number using "integer_exp" as the seed value.

Syntax
rand ( integer_exp ) 

SQL Server Trigonometry

acos

Returns the arccosine of "numeric_exp" in radians. The arccosine is the angle whose cosine is "numeric_exp".

Syntax
acos ( numeric_exp ) 
asin

Returns the arcsine of "numeric_exp" in radians. The arcsine is the angle whose sine is "numeric_exp".

Syntax
asin ( numeric_exp ) 
atan

Returns the arctangent of "numeric_exp" in radians. The arctangent is the angle whose tangent is "numeric_exp".

Syntax
atan ( numeric_exp ) 
atn2

Returns the arctangent of the x and y coordinates specified by "numeric_exp1" and "numeric_exp2", respectively, in radians. The arctangent is the angle whose tangent is "numeric_exp1".

Syntax
atn2 ( numeric_exp1, numeric_exp2 ) 
cos

Returns the cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cos ( numeric_exp ) 
cot

Returns the cotangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cot ( numeric_exp ) 
degrees

Returns "numeric_exp" radians converted to degrees.

Syntax
degrees ( numeric_exp ) 
radians

Returns the number of radians converted from "numeric_exp" degrees.

Syntax
radians ( numeric_exp ) 
sin

Returns the sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sin ( numeric_exp ) 
tan

Returns the tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tan ( numeric_exp ) 

Teradata

account

Returns the account string for the current user.

Syntax
{account} 

add_months

Returns the date or the datetime resulting from adding "integer_exp" months to 'date_exp" or "datetime_exp".

Syntax
add_months ( date_exp | datetime_exp, integer_exp ) 

bytes

Returns the number of bytes contained in "byte_exp". "Byte_exp" is restricted to BYTE or VARBYTE.

Syntax
bytes ( byte_exp ) 

case_n

Evaluates a list of conditions and returns the position of the first condition that evaluates to TRUE, provided that no prior condition in the list evaluates to UNKNOWN. The keywords must be enclosed in curly brackets. The NO CASE is an optional condition that evaluates to TRUE if every "conditional_exp" in the list evaluates to FALSE. The NO CASE OR UNKNOWN condition evaluates to TRUE if every "conditional_exp" in the list evaluates to FALSE, or if a "conditional_exp" evaluates to UNKNOWN and all prior conditions in the list evaluate to FALSE. The UNKNOWN is an optional condition that evaluates to TRUE if a conditional_expression evaluates to UNKNOWN and all prior conditions in the list evaluate to FALSE.

Syntax
case_n ( condition_exp_list [, NO CASE | UNKNOWN | NO
CASE OR UNKNOWN [, UNKNOWN ]] ) 

char2hexint

Returns the hexadecimal representation for "string_exp".

Syntax
char2hexint ( string_exp ) 

characters

Returns an integer value representing the number of logical characters or bytes contained in "string_exp".

Syntax
characters ( string_exp ) 

database

Returns the name of the default database for the current user.

Syntax
{database} 

date

Returns the current date.

Syntax
{date} 

format

Returns the declared format for "exp". The data type returned by a FORMAT phrase is a variable character string of up to 30 characters.

Syntax
format ( expression ) 

index

Returns the starting position of "string_exp2" in "string_exp1".

Syntax
index ( string_exp1, string_exp2 ) 

log

Computes the base 10 logarithm of "numeric_exp". "Numeric_exp" must be a non-zero, positive, numeric expression.

Syntax
log ( numeric_exp ) 

nullif

Returns NULL if "scalar_exp1" and "scalar_exp2" are equal. Otherwise, it returns "scalar_exp1". "Scalar_exp1" and "scalar_exp2" can be any data type.

Syntax
nullif ( scalar_exp1, scalar_exp2 ) 

nullifzero

Converts data from zero to null to avoid division by zero.

Syntax
nullifzero ( numeric_exp ) 

profile

Returns the current profile for the session or NULL if none.

Syntax
{profile} 

random

Returns a random integer number for each row of the results table. "Lower_bound" and "upper_bound" are integer constants. The limits for "lower_bound" and "upper_bound" range from -2147483648 to 2147483647 inclusive. "Upper_bound" must be greater than or equal to "lower_bound".

Syntax
random ( lower_bound, upper_bound ) 

role

Returns the current role for the session or NULL if none.

Syntax
{role} 

session

Returns the number of the session for the current user.

Syntax
{session} 

soundex

Returns a character string that represents the Soundex code for "string_exp".

Syntax
soundex ( string_exp ) 

substr

Returns the substring of "string_exp" that starts at position "integer_exp1". The first character in "string_exp" is at position 1. "Integer_exp2" can be used to select fewer characters, by default it selects character to the end of the string.

Syntax
substr ( string_exp, integer_exp1 [ , integer_exp2 ]
) 

time

Returns the current time based on a 24-hour day.

Syntax
{time} 

type

Returns the data type defined for "exp".

Syntax
type ( exp ) 

user

Returns the user name of the current user.

Syntax
{user} 

vargraphic

Returns a character string that represents the vargraphic code for "string_exp".

Syntax
vargraphic ( string_exp ) 

zeroifnull

Converts data from NULL to 0 to avoid errors created by a NULL value. If "numeric_exp" is not NULL, it returns the value of "numeric_exp". If "numeric_exp" is a character string, it is converted to a numeric value of FLOAT data type. If "numeric_exp" is NULL or zero, it returns zero.

Syntax
zeroifnull ( numeric_exp ) 

Teradata Trigonometry

acos

Returns the arccosine of "numeric_exp" in radians. The arccosine is the angle whose cosine is "numeric_exp". "Numeric_exp" must be between -1 and 1, inclusive.

Syntax
acos ( numeric_exp ) 
acosh

Returns the inverse hyperbolic cosine of "numeric_exp" where "numeric_exp" can be any real number equal to or greater than 1.

Syntax
acosh ( numeric_exp ) 
asin

Returns the arcsine of "numeric_exp" in radians. The arcsine is the angle whose sine is "numeric_exp". "Numeric_exp" must be between -1 and 1, inclusive.

Syntax
asin ( numeric_exp ) 
asinh

Returns the inverse hyperbolic sine of "numeric_exp" where "numeric_exp" can be any real number.

Syntax
asinh ( numeric_exp ) 
atan

Returns the arctangent of "numeric_exp" in radians where the arctangent is the angle whose tangent is "numeric_exp".

Syntax
atan ( numeric_exp ) 
atan2

Returns the arctangent of the x and y coordinates specified by "numeric_exp1" and "numeric_exp2", respectively, in radians. The returned angle will be between - and π radians, excluding π.

Syntax
atan2 ( numeric_exp1, numeric_exp2 ) 
atanh

Returns the inverse hyperbolic tangent of "numeric_exp" where "numeric_exp" can be any real number between 1 and -1, excluding 1 and -1.

Syntax
atanh (numeric_exp ) 
cos

Returns the cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cos ( numeric_exp ) 
cosh

Returns the hyperbolic cosine of "numeric_exp" where "numeric_exp" can be any real number.

Syntax
cosh ( numeric_exp ) 
sin

Returns the sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sin ( numeric_exp ) 
sinh

Returns the hyperbolic sine of "numeric_exp" where "numeric_exp" can be any real number.

Syntax
sinh ( numeric_exp ) 
tan

Returns the tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tan ( numeric_exp ) 
tanh

Returns the hyperbolic tangent of "numeric_exp" where "numeric_exp" can be any real number.

Syntax
tanh ( numeric_exp ) 

SAP BW

SAP BW Trigonometry

arccos

Returns the arccosine of "numeric_exp in radians". The arccosine is the angle whose cosine is "numeric_exp".

Syntax
arccos ( numeric_exp ) 
arcsin

Returns the arcsine of "numeric_exp" in radians. The arcsine is the angle whose sine is "numeric_exp".

Syntax
arcsin ( numeric_exp ) 
arctan

Returns the arctangent of "numeric_exp" in radians. The arctangent is the angle whose tangent is "numeric_exp".

Syntax
arctan ( numeric_exp ) 
cos

Returns the cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cos ( numeric_exp ) 
sin

Returns the sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sin ( numeric_exp ) 
tan

Returns the tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tan ( numeric_exp ) 
coshyp

Returns the hyperbolic cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
coshyp ( numeric_exp ) 
sinhyp

Returns the hyperbolic sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sinhyp ( numeric_exp ) 
tanhyp

Returns the hyperbolic tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tanhyp ( numeric_exp ) 

SAP BW Math

log10

Returns the base ten logarithm of "numeric_exp".

Syntax
log10 ( numeric_exp ) 

Sybase

ascii

Returns a number representing the ascii code value of the leftmost character of "string_exp".

Syntax
ascii ( string_exp ) 
Example
ascii( 'A' ) 

Result: 65

char

Converts "integer_exp" to a character value. Char is usually used as the inverse of ascii where "integer_exp" must be between 0 and 255. If the resulting value is the first byte of a multibyte character, the character may be undefined.

Syntax
char ( integer_exp ) 

charindex

Searches "string_exp2" for the first occurrence of "string_exp1" and returns an integer that represents its starting position. If "string_exp1" is not found, zero is returned. If "string_exp1" contains wildcard characters, charindex treats them as literals.

Syntax
charindex ( string_exp1, string_exp2 ) 

datalength

Returns the length in bytes of "string_exp".

Syntax
datalength ( string_exp ) 

dateadd

Returns the date resulting from adding "integer_exp" units indicated by datepart (day, month, year) to "date_exp". Note that the datepart argument must be enclosed in curly brackets.

Syntax
dateadd ( ' { ' datepart ' } ' , integer_exp, date_exp
) 
Example
dateadd ( {dd}, 16, 1997-06-16 ) 

Result: Jul 2, 1997

datediff

Returns the number of units indicated by datepart (day, month, year) between "date_exp1" and "date_exp2". Note that the datepart argument must be enclosed in curly brackets.

Syntax
datediff ( ' { ' datepart ' } ' , date_exp1, date_exp2
) 
Example
datediff ( {yy}, 1984-01-01, 1997-01-01 ) 

Result: 13

datename

Returns part of a datetime, smalldatetime, date, or time value as an ASCII string. Note that the datepart argument must be enclosed in curly brackets.

Syntax
datename ( ' { ' datepart ' } ' , date_exp ) 
Example
datename ( {mm}, 1999-05-01 ) 

Result: May

datepart

Returns part of a datetime, smalldatetime, date, or time value (e.g. month) as an integer. Note that the datepart argument must be enclosed in curly brackets.

Syntax
datepart ( ' { ' datepart ' } ' , date_exp ) 
Example
datepart ( {mm}, 1999-05-01 ) 

Result: 5

day

Returns the day of the month (1-31) from "date_exp".

Syntax
day ( date_exp ) 

difference

Returns an integer value representing the difference between the values returned by the data source specific soundex function for "string_exp1" and "string_exp2". The value returned ranges from 0 to 4, with 4 indicating the best match. Note that 4 does not mean that the strings are equal.

Syntax
difference ( string_exp1, string_exp2 ) 

getdate

Returns current system date and time.

Syntax
getdate () 

left

Returns the leftmost "integer_exp" characters of "string_exp".

Syntax
left ( string_exp, integer_exp ) 

ltrim

Returns "string_exp" with any leading spaces removed.

Syntax
ltrim ( string_exp ) 

month

Returns the month (1-12) from "date_exp".

Syntax
month ( date_exp ) 

patindex

Returns an integer representing the starting position of the first occurrence of "string_exp1" in "string_exp2' or returns 0 if "string-exp1" is not found. By default, patindex returns the offset in characters. The offset can be returned in bytes by setting the return type to bytes. The % wildcard character must precede and follow the pattern in "string_exp1", except when searching for first or last characters.

Syntax
patindex ( string_exp1, string_exp2 [ using {bytes |
chars | characters} ] ) 

rand

Returns a random float value between 0 and 1, using the optional "integer_exp" as a seed value.

Syntax
rand ( integer_exp ) 

replicate

Returns a string with the same datatype as "string_exp", containing the same expression repeated "integer_exp" times or as many times as will fit into a 225-byte space, whichever is less.

Syntax
replicate ( string_exp, integer_exp ) 

reverse

Returns the reverse of "string_exp".

Syntax
reverse ( string_exp ) 

right

Returns the rightmost "integer_exp" characters of "string_exp".

Syntax
right ( string_exp, integer_exp ) 

round

Returns "numeric_exp" rounded to the nearest value "integer_exp" places to the right of the decimal point.

Syntax
round ( numeric_exp, integer_exp ) 

rtrim

Returns "string_exp" with trailing spaces removed.

Syntax
rtrim ( string_exp ) 

soundex

Returns a four-character soundex code for character strings that are composed of a contiguous sequence of valid single- or double byte Roman letter.

Syntax
soundex ( string_exp ) 

space

Returns a string with "integer_exp" single byte spacing.

Syntax
space ( integer_exp ) 

str

Returns a string representation of "numeric_exp". "Integer_exp1" is the length of the returned string and has a default setting of 10. "Integer_exp2" is the number of decimal digits and has a default setting of 0. Both are optional values.

Syntax
str ( numeric_exp [ , integer_exp1 [ , integer_exp2 ]
] ) 

stuff

Deletes "integer_exp2" characters from "string_exp1" starting at "integer_exp1", and inserts "string_exp2" into "string_exp1" at that position. To delete characters without inserting other characters, "string_exp2" should be NULL and not " ", which indicates a single space.

Syntax
stuff ( string_exp1, integer_exp1, integer_exp2, string_exp2
) 

substring

Returns the substring of "string_exp" that starts at position "integer_exp1". "Integer_exp2" specifies the number of characters in the substring.

Syntax
substring ( string_exp, integer_exp1, integer_exp2 ) 

to_unichar

Returns a unichar expression having the value "integer_exp". If "integer_exp" is in the range 0xD800..0xDFFF, the operation is aborted. If the "integer_exp" is in the range 0..0xFFFF, a single Unicode value is returned. If "integer_exp" is in the range 0x10000..0x10FFFF, a surrogate pair is returned.

Syntax
to_unichar ( integer_exp ) 

uhighsurr

Returns 1 if the Unicode value at "integer_exp" is the high half of a surrogate pair (which should appear first in the pair). Otherwise, it returns 0. This function allows you to write explicit code for surrogate handling. Particularly, if a substring starts on a Unicode character where uhighsurr() is true, extract a substring of at least 2 Unicode values, as substr() does not extract just 1. Substr() does not extract half of a surrogate pair.

Syntax
uhighsurr ( string_exp, integer_exp ) 

ulowsurr

Returns 1 if the Unicode value at "integer_exp" is the low half of a surrogate pair (which should appear second in the pair). Otherwise, it returns 0. This function allows you to explicitly code around the adjustments performed by substr(), stuff(), and right(). Particularly, if a substring ends on a Unicode value where ulowsurr() is true, extract a substring of 1 less characters (or 1 more), since substr() does not extract a string that contains an unmatched surrogate pair.

Syntax
ulowsurr ( string_exp, integer_exp ) 

uscalar

Returns the Unicode scalar value for the first Unicode character in "string_exp". If the first character is not the high-order half of a surrogate pair, then the value is in the range 0..0xFFFF. If the first character is the high-order half of a surrogate pair, a second value must be a low-order half, and the return value is in the range 0x10000..0x10FFFF. If this function is called on a uchar_exp containing an unmatched surrogate half, the operation is aborted.

Syntax
uscalar ( string_exp ) 

year

Returns the year from date_exp.

Syntax
year ( date_exp ) 

Sybase Math

log

Returns the natural logarithm of "numeric_exp".

Syntax
log ( numeric_exp ) 
log10

Returns the base ten logarithm of "numeric_exp".

Syntax
log10 ( numeric_exp ) 
pi

Returns the constant value of pi as a floating point value.

Syntax
pi () 
sign

Returns an indicator denoting the sign of "numeric_exp": +1 if "numeric_exp" is positive, 0 if zero or -1 if negative.

Syntax
sign ( numeric_exp ) 

Sybase Trigonometry

acos

Returns the arccosine of "numeric_exp" in radians. The arccosine is the angle whose cosine is "numeric_exp".

Syntax
acos ( numeric_exp ) 
asin

Returns the arcsine of "numeric_exp" in radians. The arcsine is the angle whose sine is "numeric_exp".

Syntax
asin ( numeric_exp ) 
atan

Returns the arctangent of "numeric_exp" in radians. The arctangent is the angle whose tangent is "numeric_exp".

Syntax
atan ( numeric_exp ) 
tan

Returns the tangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
tan ( numeric_exp ) 
atn2

Returns the angle, in radians, whose tangent is "numeric_exp1" / "numeric_exp2".

Syntax
atn2 ( numeric_exp1, numeric_exp2 ) 
cos

Returns the cosine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cos ( numeric_exp ) 
cot

Returns the cotangent of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
cot ( numeric_exp ) 
degrees

Returns "numeric_exp" radians converted to degrees.

Syntax
degrees ( numeric_exp ) 
radians

Returns the degree equivalent of "numeric_exp". Results are of the same type as "numeric_exp". For expressions of type numeric or decimal, the results have an internal precision of 77 and a scale equal to that of "numeric_exp". When the money datatype is used, an internal conversion to float may cause some loss of precision.

Syntax
radians ( numeric_exp ) 
sin

Returns the sine of "numeric_exp" where "numeric_exp" is an angle expressed in radians.

Syntax
sin ( numeric_exp ) 

Report Functions

_add_days

Returns the datetime resulting from adding "integer_exp" days to "timestamp_exp".

Syntax
_add_days (timestamp_exp, integer_exp) 

_add_months

Returns the datetime resulting from adding "integer_exp" months to "timestamp_exp".

Syntax
_add_months (timestamp_exp, integer_exp) 

_add_years

Returns the datetime resulting from adding "integer_exp" years to "timestamp_exp".

Syntax
_add_years (timestamp_exp, integer_exp) 

_age

Returns a number that is obtained from subtracting "timestamp_exp" from today's date in YYYYMMDD format (years, months, days).

Syntax
_age (timestamp_exp) 

_day_of_week

Returns the day of week (between 1 and 7), where 1 is the first day of the week (Monday) as indicated by "integer_exp". Note that in ISO 8601 standard, a week begins with Monday as day 1.

Syntax
_day_of_week (timestamp_exp, integer_exp)  
Example
_day_of_week (2003-01-01, 1) will return 3 because 2003-01-01
was a Wednesday. 

Result: 3

_day_of_year

Returns the ordinal for the day of the year in "timestamp_ exp" (1 to 366). Also known as Julian day.

Syntax
_day_of_year (timestamp_exp) 

_days_between

Returns a positive or negative number representing the number of days between "timestamp_exp1" and "timestamp_exp2". If "timestamp_exp1" < "timestamp_exp2", the result will be a negative number.

Syntax
_days_between (timestamp_exp1, timestamp_exp2) 

_days_to_end_of_month

Returns a number representing the number of days remaining in the month represented by "timestamp_exp".

Syntax
_days_to_end_of_month (timestamp_exp) 

_first_of_month

Returns a datetime that is the first day of the month represented by "timestamp_exp".

Syntax
_first_of_month (timestamp_exp) 

_last_of_month

Returns a datetime that is the last day of the month represented by "timestamp_exp".

Syntax
_last_of_month (timestamp_exp) 

_make_timestamp

Returns a timestamp constructed from "integer_exp1" (the year), "integer_exp2" (the month) and "integer_exp3" (the day). The time portion defaults to 00:00:00.000 .

Syntax
_make_timestamp (integer_exp1, integer_exp2, integer_exp3) 

_months_between

Returns a positive or negative number representing the number of months between "timestamp_exp1" and "timestamp_exp2". If "timestamp_exp1" < "timestamp_exp2", the result will be a negative number.

Syntax
_months_between (timestamp_exp1, timestamp_exp2) 

_week_of_year

Returns the week number (1-53) of the year, represented by "timestamp_exp". According to the ISO 8601, week 1 of the year is the first week to contain a Thursday, which is equivalent to the first week containing January 4th. A week starts on a Monday (day 1) and ends on a Sunday (day 7).

Syntax
_week_of_year (timestamp_exp) 

_years_between

Returns a positive or negative integer number representing the number of years between "timestamp_exp1" and "timestamp_exp2". If "timestamp_exp1" < "timestamp_exp2" a negative value is returned.

Syntax
_years_between (timestamp_exp1, timestamp_exp2) 

_ymdint_between

Returns a number representing the difference between "timestamp_exp1" and "timestamp_exp2". This value has the form YYYYMMDD, where YYYY represents the number of years, MM represents the number of months, and DD represents the number of days.

Syntax
_ymdint_between (timestamp_exp1, timestamp_exp2) 

abs

Returns the absolute value of "numeric_exp". If "numeric_exp" is negative, a positive value is returned.

Syntax
abs (numeric_exp) 

AsOfDate

Returns the date value of the AsOfDate expression, if it is defined. Otherwise, AsOfDate returns the report execution date.

Syntax
AsOfDate () 

AsOfTime

Returns the time value of the AsOfTime expression, if it is defined. Otherwise, AsOfTime returns the report execution time.

Syntax
AsOfTime () 

BurstKey

Returns the burst key.

Syntax
BurstKey () 

BurstRecipients

Returns the distribution list of burst recipients.

Syntax
BurstRecipients () 

ceiling

Returns the smallest integer greater than or equal to "numeric_exp".

Syntax
ceiling (numeric_exp) 

CellValue

Returns the value of the current crosstab cell.

Syntax
CellValue () 

character_length

Returns the number of characters in "string_exp".

Syntax
character_length (string_exp) 

ColumnNumber

Returns the current column number.

Syntax
ColumnNumber () 

CubeCreatedOn

Returns the date and time when the cube was created. "Dimension" specifies from which cube to retrieve the metadata. If the dimension source is an IBM Cognos PowerCube (.mdc), the function returns a blank string. The initial creation date of a PowerCube is not maintained.

Syntax
CubeCreatedOn (dimension) 

CubeCurrentPeriod

Returns the current period for the cube. "Dimension" specifies from which cube to retrieve the metadata.

Syntax
CubeCurrentPeriod (dimension) 

CubeDataUpdatedOn

Returns the date time that data in the cube was last updated. "Dimension" specifies from which cube to retrieve the metadata.

Syntax
CubeDataUpdatedOn (dimension) 

CubeDefaultMeasure

Returns the name of the default measure for the cube. "Dimension" specifies from which cube to retrieve the metadata.

Syntax
CubeDefaultMeasure (dimension) 

CubeDescription

Returns the description of the cube. "Dimension" specifies from which cube to retrieve the metadata.

Syntax
CubeDescription (dimension) 

CubeIsOptimized

Returns TRUE if the cube is optimized. "Dimension" specifies from which cube to retrieve the metadata.

Syntax
CubeIsOptimized (dimension) 

CubeName

Returns the name of the cube. "Dimension" specifies from which cube to retrieve the metadata.

Syntax
CubeName (dimension) 

CubeSchemaUpdatedOn

Returns the date time that the cube schema was last updated. "Dimension" specifies from which cube to retrieve the metadata.

Syntax
CubeSchemaUpdatedOn (dimension) 

exp

Returns the constant 'e' raised to the power of "numeric_exp". The constant 'e' is the base of the natural logarithm.

Syntax
exp (numeric_exp) 

extract

Returns an integer representing the value of "datepart_exp" ("year", "month", "day", "hour", "minute", "second" (=default)) in "datetime_exp".

Syntax
extract (datepart_exp , datetime_exp) 

floor

Returns the largest integer less than or equal to "numeric_exp".

Syntax
floor (numeric_exp) 

GetLocale

Returns the run locale (deprecated).

Syntax
GetLocale () 

HorizontalPageCount

Returns the current horizontal page count.

Syntax
HorizontalPageCount () 

HorizontalPageNumber

Returns the current horizontal page number.

Syntax
HorizontalPageNumber () 

InScope

Returns boolean 1 (TRUE) when the cell is in the scope of the data items and MUNs; otherwise, returns 0 (FALSE).

Syntax
InScope (dataItem, MUN, ...) 

IsBursting

Returns boolean 1 (TRUE) when the report will be distributed to the recipient; otherwise returns 0 (FALSE).

Syntax
IsBursting ('recipientName') 

IsCrosstabColumnNodeMember

Returns boolean 1 (TRUE) if the current node is a crosstab column node member.

Syntax
IsCrosstabColumnNodeMember () 

IsCrosstabRowNodeMember

Returns boolean 1 (TRUE) if the current node is a crosstab row node member.

Syntax
IsCrosstabRowNodeMember () 

IsFirstColumn

Returns boolean 1 (TRUE) if the current column is the first column.

Syntax
IsFirstColumn () 

IsInnerMostCrosstabColumnNodeMember

Returns boolean 1 (TRUE) if the current node is an innermost crosstab column node member.

Syntax
IsInnerMostCrosstabColumnNodeMember () 

IsInnerMostCrosstabRowNodeMember

Returns boolean 1 (TRUE) if the current node is an innermost crosstab row node member.

Syntax
IsInnerMostCrosstabRowNodeMember () 

IsLastColumn

Returns boolean 1 (TRUE) if the current column is the last column.

Syntax
IsLastColumn () 

IsLastInnerMostCrosstabColumnNodeMember

Returns boolean 1 (TRUE) if the current node is the last innermost crosstab column node member.

Syntax
IsLastInnerMostCrosstabColumnNodeMember () 

IsLastInnerMostCrosstabRowNodeMember

Returns boolean 1 (TRUE) if the current node is the last innermost crosstab row node member.

Syntax
IsLastInnerMostCrosstabRowNodeMember () 

IsOuterMostCrosstabColumnNodeMember

Returns boolean 1 (TRUE) if the current node is an outermost crosstab column node member.

Syntax
IsOuterMostCrosstabColumnNodeMember () 

IsOuterMostCrosstabRowNodeMember

Returns boolean 1 (TRUE) if the current node is an outermost crosstab row node member.

Syntax
IsOuterMostCrosstabRowNodeMember () 

IsPageCountAvailable

Returns boolean 1 (TRUE) if the page count is available for the current execution of the report.

Syntax
IsPageCountAvailable () 

ln

Returns the natural logarithm of "numeric_exp".

Syntax
ln (numeric_exp) 

Locale

Returns the run locale.

Syntax
Locale () 

lower

Returns "string_exp" with all uppercase characters shifted to lowercase.

Syntax
lower (string_exp) 

mapNumberToLetter

Adds "integer_exp" to "string_exp".

Syntax
mapNumberToLetter (string_exp, integer_exp) 
Example
mapNumberToLetter ('a', 1) will result in 'b'. 

Result: 'b'

mod

Returns an integer value representing the remainder (modulo) of "integer_exp1" / "integer_exp2".

Syntax
mod (integer_exp1, integer_exp2) 

ModelPath

Returns the model path.

Syntax
ModelPath () 

Now

Returns the current system time.

Syntax
Now () 

nullif

Returns NULL if "string_exp1" equals "string_exp2" (case insensitive), otherwise returns "string_exp1".

Syntax
nullif (string_exp1, string_exp2) 

octet_length

Returns the number of bytes in "string_exp".

Syntax
octet_length (string_exp) 

PageCount

Returns the current page count. This function works only when the report output is PDF or Excel. If you save the report output, this function works for all formats.

Syntax
PageCount () 

PageName

Returns the current page name.

Syntax
PageName () 

PageNumber

Returns the current page number.

Syntax
PageNumber () 

ParamCount

Returns parameter count of the variable identified by "parameterName".

Syntax
ParamCount ('parameterName') 

ParamDisplayValue

Returns a string that is the parameter display value of the variable identified by "parameterName".

Syntax
ParamDisplayValue ('parameterName') 

ParamName

Returns the parameter name of the variable identified by "parameterName".

Syntax
ParamName ('parameterName') 

ParamNames

Returns all parameter names.

Syntax
ParamNames () 

ParamValue

Returns a string that is the parameter value of the variable identified by "parameterName".

Syntax
ParamValue ('parameterName') 

position

Returns the integer value representing the starting position of "string_exp1" in "string_exp2". Returns 0 if "string_exp1" is not found.

Syntax
position (string_exp1, string_exp2) 

power

Returns "num_exp1" raised to the power of "num_exp2".

Syntax
power (num_exp1, num_exp2) 

ReportAuthorLocale

Returns the author locale.

Syntax
ReportAuthorLocale() 

ReportCreateDate

Returns the date that the report was created.

Syntax
ReportCreateDate () 

ReportDate

Returns the report execution date and time.

Syntax
ReportDate () 

ReportDescription

Returns the report description. This function works only when the report is run from an IBM Cognos Connection.

Syntax
ReportDescription () 

ReportID

Returns the report id.

Syntax
ReportID () 

ReportLocale

Returns the run locale.

Syntax
ReportLocale () 

ReportName

Returns the report name. This function works only when the report is run from an IBM Cognos Connection.

Syntax
ReportName () 

ReportOption

Returns the value of the run option variable identified by "optionName". Possible values for "optionName" are: attachmentEncoding, burst, cssURL, email, emailAsAttachment, emailAsURL, emailBody, emailSubject, emailTo, emailToAddress, history, metadataModel, outputEncapsulation, outputFormat, outputLocale, outputPageDefinition, outputPageOrientation, primaryWaitThreshold, print, printer, printerAddress, prompt, promptFormat, saveAs, saveOutput, secondaryWaitThreshold, verticalElements, xslURL.

Syntax
ReportOption ('optionName') 

ReportOutput

Returns the name of the output format. Possible return values are: CSV, HTML, layoutDataXML, MHT, PDF, rawXML, singleXLS, spreadsheetML, XLS, XML, XLWA.

Syntax
ReportOutput () 

ReportPath

Returns the report path. This function works only when the report is run from an IBM Cognos Connection.

Syntax
ReportPath () 

ReportProductLocale

Returns the product locale.

Syntax
ReportProductLocale () 

ReportSaveDate

Returns the date when the report was last saved.

Syntax
ReportSaveDate () 

round

Returns "numeric_exp" rounded to the nearest value "integer_exp" places to the right of the decimal point. If "integer_exp" is negative, "numeric_exp" is rounded to the nearest absolute value "integer_exp" places to the left of the decimal point.

Syntax
round (numeric_exp, integer_exp) 
Example
round (125, -1) rounds to 130. 

Result: 130.

RowNumber

Returns the current row.

Syntax
RowNumber () 

ServerLocale

Returns the locale of the server that runs the report.

Syntax
ServerLocale () 

ServerName

Returns the name of the server that runs the report.

Syntax
ServerName () 

sqrt

Returns the square root of "numeric_exp". "Numeric_exp" must be non-negative.

Syntax
sqrt (numeric_exp) 

substring

Returns the substring of "string_exp" that starts at position "integer_exp1" for "integer_exp2" characters or to the end of "string_exp" if "integer_exp2" equals -1. The first character in "string_exp" is at position 1.

Syntax
substring (string_exp , integer_exp1, integer_exp2) 

TOCHeadingCount

Returns the table of contents heading count for a specified heading level.

Syntax
TOCHeadingCount (headingLevel) 

Today

Returns the current system date.

Syntax
Today () 

trim

Returns "string_exp" trimmed of any leading and trailing blanks or trimmed of the character specified by "match_character_exp". "Trim_what_exp" may be: "LEADING", "TRAILING", or "BOTH" (default). "Match_character_exp" must be an empty string to trim blanks, or specify a character to be trimmed.

Syntax
trim (trim_what_exp, match_character_exp, string_exp) 

upper

Returns "string_exp" with all lowercase characters shifted to uppercase.

Syntax
upper (string_exp) 

URLEncode

Returns the url encoded value of the input text.

Syntax
URLEncode ('text') 

Data Type Casting Functions

date2string

Returns a date as a string in YYYY-MM-DD format.

Syntax
date2string (date_exp) 
date2timestamp

Converts a date to a timestamp. The time part of the timestamp will equal zero.

Syntax
date2timestamp (date_exp) 
date2timestampTZ

Converts a date to a timestamp with a time zone. The time and time zone parts of the timestamp will equal zero.

Syntax
date2timestampTZ (date_exp) 
DTinterval2string

Returns a date time interval as a string in "DDDD HH:MM:SS.FFFFFFF" or "-DDDD HH:MM:SS.FFF" format.

Syntax
DTinterval2string (DTinterval_exp) 
DTinterval2stringAsTime

Returns a date time interval as a string in "HHHH:MM:SS.FFFFFFF" or "HH:MM:SS.FFF". Days are converted to hours.

Syntax
DTinterval2stringAsTime (DTinterval_exp) 
int2DTinterval

Converts an integer to a date time interval. "String_exp" specifies what "integer_exp" represents: "ns" = nanoseconds, "s" = seconds (default), "m" = minutes, "h" = hours, "d" = days.

Syntax
int2DTinterval (integer_exp, string_exp) 
int2YMinterval

Converts an integer to a year month interval. "String_exp" specifies what "integer_exp" represents: "y" = years, "m" = months (default).

Syntax
int2YMinterval (integer_exp, string_exp) 
number2string

Converts a number to a string, using the %g format specifier (C/C++ syntax).

Syntax
number2string (num_exp) 
string2date

Returns a date string as a date in "YYYY-MM-DD" format.

Syntax
string2date (string_exp) 
string2double

Returns a floating point number. "String_exp" has the following form:"[whitespace] [sign] [digits] [digits] [ {d | D |e | E }[sign]digits]"

Syntax
string2double (string_exp) 
string2DTinterval

Returns a date-time interval string as a date time interval in "[-]DD HH:MM[:SS[.FFF]]" format.

Syntax
string2DTinterval (string_exp) 
string2int32

Returns an integer. "String_exp" has the following form: "[whitespace] [{+ | -}] [digits]"

Syntax
string2int32 (string_exp) 
string2int64

Returns a long integer. "String_exp" has the following form: "[whitespace] [{+ | -}] [digits]"

Syntax
string2int64 (string_exp) 
string2time

Returns a time string as a time in "HH:MM:SS.FFFFFFF" format.

Syntax
string2time (string_exp) 
string2timestamp

Returns a timestamp string as a timestamp in "YYYY-MM-DD [T|t|[white space]+] HH:MM:SS.FFFFFFF" format.

Syntax
string2timestamp (string_exp) 
string2timestampTZ

Returns a timestamp with time zone "YYYY-MM-DD HH:MM:SS.FFFFFFF +HHMM" or "YYYY-MM-DD [T|t] HH:MM:SS.FFF -HHMM" format.

Syntax
string2timestampTZ (string_exp) 
string2YMinterval

Returns a year-month interval string as a Year Month Interval in "[-]YY MM" format.

Syntax
string2YMinterval (string_exp) 
time2string

Returns a time as a string in HH:MM:SS.FFF format.

Syntax
time2string (time_exp) 
timestamp2date

Converts a timestamp to a date. The time part of the timestamp will be ignored.

Syntax
timestamp2date (timestamp_exp) 
timestamp2string

Returns a timestamp as a string in YYYY-MM-DD HH:MM:SS.FFFFFFF format.

Syntax
timestamp2string (timestamp_exp) 
timestamp2timestampTZ

Converts a timestamp to a timestamp with a time zone. The displacement part of the timestamp with the time zone will be zero.

Syntax
timestamp2timestampTZ (timestamp_exp) 
timestampTZ2date

Converts a timestamp with a time zone to a date. The time and time zone parts of the timestamp will be ignored.

Syntax
timestampTZ2date (timestampTZ_exp) 
timestampTZ2string

Returns a timestamp with the time zone as a string in "YYYY-MM-DD HH:MM:SS.FFFFFFF +HHMM" or "YYYY-MM-DD HH:MM:SS.FFF -HHMM" format.

Syntax
timestampTZ2string (timestampTZ_exp) 
timestampTZ2timestamp

Converts a timestamp with time zone to a timestamp. The displacement part of the timestamp with the time zone will be ignored.

Syntax
timestampTZ2timestamp (timestampTZ_exp) 
timeTZ2string

Returns a time with the time zone as a string in "HH:MM:SS.FFF +HHMM" or "HH:MM:SS.FFFFFFF -HHMM" format.

Syntax
timeTZ2string (timeTZ_exp) 
Example
"-05:30" means a TimeZone of GMT minus 5 hours and 30
minutes. 

Result: GMT minus 5 hours and 30 minutes

YMinterval2string

Returns a year month interval as a string in "(YY MM)" or "-(YY MM)" format.

Syntax
YMinterval2string (YMinterval_exp)