Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-02 |
|
|
View PDF |
The STARTOF function returns the starting date of a time period in a dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR.
Important:
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 or text (see "Automatic Conversion of DATE Values to Text Values")
Syntax
STARTOF(dwmqy-dimension)
Arguments
A dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR. When you have explicitly defined your own relation between dimensions of this type, you can use the name of this time relation here.
Notes
How STARTOF Works
STARTOF returns the first date of the time period that is first in the current status list of the dimension.
Phased or Multiple Periods
STARTOF is particularly useful when the dimension has a phase that differs from the default or when the time periods are formed from multiple weeks or years. For example, when the dimension has four-week time periods, the STARTOF function identifies the starting date of a particular four-week period.
Format of the Result Returned by STARTOF
When you display the result returned by STARTOF, the date is formatted 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, the day names specified in the DAYNAMES option and the month names specified in the MONTHNAMES option are used. You can use the result returned by STARTOF anywhere that a DATE value is expected.
Retrieving the Last Valid Date of a Time Period
The ENDOF function, which returns the last date of a time period.
Examples
Example 24-25 Finding the Fiscal Year Starting Date
The following statements define a year dimension (called FYEAR, for a fiscal year that ends in June), specify how the year will be formatted, add dimension values for fiscal years 1996 through 1998, and produce a report of the starting date of each fiscal year.
DEFINE fyear DIMENSION YEAR ENDING June VNF 'FY<ff>' MAINTAIN fyear ADD '30JUN96' '30JUN98' REPORT W 14 STARTOF(fyear)
These statements produce the following output.
FYEAR STARTOF(FYEAR) --------- -------------- FY96 01JUL95 FY97 01JUL96 FY98 01JUL97