Loading current timestamps

The Loader can insert values into columns with a timestamp data type based on a reading of the time-of-day clock. For example, the STARTDATE and ENDDATE of an offer in WebSphere Commerce can have values based on the time at which the offer is inserted into the table. To support this functionality, the Loader package uses the MLTIME table to keep the timestamp instances. The schema for this table is as follows:

  table MLTIME
    ( 
    INSTANCEID BIGINT not null,
    MLTIMESTAMP TIMESTAMP
    )
  1. Modify the values of the properties specified in the new Loader customizer property file.

    The name of the table and its columns can be customized by changing the following properties in the Loader customizer property file:

      TimestampTableName = MLTIME
      TimestampIdColumn = INSTANCEID
      TimestampValueColumn = MLTIMESTAMP
    

    The input data for specifying current-timestamp values are based on timestamp string patterns. The following masks are used for specifying the durations for the timestamp:

      %D for days
      %M for months
      %Y for years
      %H for hours
      %m for minutes
      %s for seconds
    

    You can customize current-timestamp formats by modifying or adding masks in the Loader customizer property file. The following input masks are provided:

      InputCurrentTimestampFormat.1 = CURRENT TIMESTAMP
      InputCurrentTimestampFormat.2 = CURRENT TIMESTAMP %D DAYS
      InputCurrentTimestampFormat.3 = CURRENT TIMESTAMP %D DAYS %M MONTHS
      InputCurrentTimestampFormat.4 = CURRENT TIMESTAMP %D DAYS %M MONTHS %Y YEARS
      InputCurrentTimestampFormat.5 = CURRENT TIMESTAMP %Y YEARS %M MONTHS %D DAYS
      InputCurrentTimestampFormat.6 = SYSDATE
      InputCurrentTimestampFormat.7 = ADDDAYS(SYSDATE,%D)
      InputCurrentTimestampFormat.8 = ADDDAYS(ADDMONTHS(SYSDATE,%M),%D) 
      InputCurrentTimestampFormat.9 = ADDDAYS(ADDMONTHS(ADDYEARS(SYSDATE,%Y),%M),%D)
    

    Input data for the current timestamp is matched with the specified patterns. If the data matches a specified input pattern, that pattern is used to parse the input data and the Loader converts the data into the appropriate output format before inserting it into the database. New patterns can be added to the above list provided the subscript numbers are ordered sequentially.

  2. Set the target output formats for specifying current timestamps:
    1. CurrentTimestampFormat.Load is used when the Loader is operating in load or import mode.
    2. CurrentTimestampFormat.JDBC is used when the Loader uses JDBC to insert, update, or delete values in the database.

    The default target patterns in the Loader are as follows:

      CurrentTimestampFormat.Load = CURRENT TIMESTAMP %Y YEARS %M MONTHS %D DAYS 
        %h HOURS %m MINUTES %s SECONDS 
      CurrentTimestampFormat.JDBC = CURRENT TIMESTAMP %Y YEARS %M MONTHS %D DAYS
        %h HOURS %m MINUTES %s SECONDS
    

    When you customize the CurrentTimestampFormat.Load and CurrentTimestampFormat.JDBC properties, you should make sure that the syntax of the resulting statement is valid for the given database management system.

    The CurrentTimestampLiteral property is used by the Loader to make an early determination of whether the value for the timestamp column is in a current-timestamp format, thus avoiding expensive computations to determine that the value is not a string representation of timestamp.

      CurrentTimestampLiteral = CURRENT TIMESTAMP
    

    DB2 The default value for this property for DB2 is CURRENT TIMESTAMP.

    Oracle The default value for the Oracle database is SYSDATE.

Feedback