Interval methods

You can use the Interval methods to extract information about binary qualifiers. To use these methods, instantiate objects of the IntervalYM and IntervalDF classes, which inherit these variables from the Interval base class.

Some of the tasks you can perform and the methods you can use follow:
  • Extracting the length of a qualifier:
    public static byte getLength(short qualifier)
  • Extracting the starting field code (one of the TU_XXX variables) from a qualifier:
    public static byte getStartCode(short qualifier)
  • Extracting the ending field code (one of the TU_XXX variables) from a qualifier:
    public static byte getEndCode(short qualifier)
  • Obtaining the string value that corresponds to the TU_XXX value of part of an interval (for example, getFieldName(TU_YEAR) returns the string year):
    public static String getFieldName(byte code)
  • Obtaining the entire name of the interval as a character string, taking a qualifier as input:
    public static String getIfxTypeName(int type, 
       short qualifier)
  • Obtaining the number of digits in the FRACTION part of the INTERVAL data type:
    public static byte getScale(short qualifier)
  • Creating a binary qualifier from a length, start code (TU_XXX), and end code (TU_XXX):
    public static short getQualifier(byte length, byte
       startCode, byte endCode) throws SQLException

    For example, getQualifier(4, TU_YEAR, TU_MONTH) creates a binary representation of the YEAR TO MONTH qualifier.