Skip Headers

Oracle® OLAP DML Reference
10g Release 1 (10.1)

Part Number B10339-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

BEGINDATE

The BEGINDATE function returns the beginning date of the first time period for which an expression has a non-NA value.


Note:

You can only use this function with dimensions of type DAY, WEEK, MONTH, QUARTER, or YEAR. You cannot use this function for time dimensions that are implemented as hierarchical dimensions of type TEXT.

Return Value

DATE

Syntax

BEGINDATE(expression)

Arguments

expression

The expression must have exactly one dimension that has a type of DAY, WEEK, MONTH, QUARTER, or YEAR.

Notes


NA Values

When all the values of the expression are NA, BEGINDATE returns NA.


How BEGINDATE Works

BEGINDATE returns the first date of the first time period in dimension status for which the expression has a non-NA value. For example, assume that an expression is dimensioned by month, and that Jan97 is the first dimension value for which the expression has a non-NA value. In this case, BEGINDATE returns the date January 1, 1997.


Format of the Date

When you display the result returned by BEGINDATE, Oracle OLAP formats the date according to the date template in the DATEFORMAT option. When the day of the week or the name of the month is used in the date template, Oracle OLAP uses the day names specified in the DAYNAMES option and the month names specified in the MONTHNAMES option. You can use the result returned by BEGINDATE anywhere that a DATE value is expected.


DATE-to-TEXT Conversion

You can also use the result where a text value is expected. Oracle OLAP automatically converts the date to a text value, using the current template in the DATEFORMAT option to format the text value. When you want to override the current DATEFORMAT template, you can convert the date result to text by using the CONVERT function with a date-format argument.


Retrieving the Last Valid Date

The ENDDATE function, which returns the last date for which an expression has a non-NA value.

Examples

Example 8-28 Finding the Beginning Date

The following statements limit the values in the month, product, and district dimensions, then send the first date for which the units variable contains a non-NA value for unit sales of tents in the Chicago district to the current outfile.

LIMIT month TO ALL
LIMIT product TO 'TENTS'
LIMIT district TO 'CHICAGO'
SHOW BEGINDATE(units)

These statements produce the following output.

01JAN95