Oracle® OLAP DML Reference 10g Release 1 (10.1) Part Number B10339-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
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
STARTOF returns the first date of the time period that is first in the current status list of the dimension.
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.
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.
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.
The ENDOF function, which returns the last date of a time period.
Examples
Example 22-24 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