3.2 WM_PERIOD Data Type
The WM_PERIOD data type is used to specify a valid time range for the session or workspace, and for a row in a version-enabled table.
The WM_PERIOD type is defined as follows:
CREATE TYPE WM_PERIOD AS OBJECT ( validFrom TIMESTAMP WITH TIME ZONE, validTill TIMESTAMP WITH TIME ZONE, MAP member function wm_period_map return varchar2);
The validFrom date is inclusive, and the validTill period is exclusive; that is, the valid date range starts on the validFrom date and extends up to but not including the validTill date.
The wm_period_map member function enables ordering (sorting) and the use of DISTINCT on columns of type WM_PERIOD.
Example 3-2 Setting the Session Valid Time to a Specific Date
Example 3-2 sets the session valid time range to 01-Jan-2003.
EXECUTE DBMS_WM.SetValidTime(TO_DATE('01-01-2003', 'MM-DD-YYYY'), TO_DATE('01-02-2003', 'MM-DD-YYYY'));
Example 3-3 inserts a row that is valid from 01-Jan-2003 until it is changed.
Example 3-3 Inserting a Row Valid for a Time Range
INSERT INTO employees VALUES(
'Baxter',
40000,
WMSYS.WM_PERIOD(TO_DATE('01-01-2003', 'MM-DD-YYYY'), DBMS_WM.UNTIL_CHANGED)
);
If you want the valid time range to be stored in views created on tables with valid time support, using two columns of type TIMEZONE WITH TIMESTAMP instead of a single column of type WM_VALID, you can set the Workspace Manager system parameter USE_SCALAR_TYPES_FOR_VALIDTIME to ON, as explained in System Parameters for Workspace Manager.
Parent topic: Workspace Manager Valid Time Support