## org.eclipse.datatools.modelbase.sql.datatypes
Interface IntervalDataType

All Superinterfaces:
  DataType, PredefinedDataType, SQLDataType, SQLObject

All Known Implementing Classes:
  IntervalDataTypeImpl

public interface IntervalDataType
extends PredefinedDataType

A representation of the model object 'Interval Data Type'. 4.6 Datetimes and intervals An interval data type is described by an interval data type descriptor. An interval data type descriptor contains: - The name of the interval data type (INTERVAL ). - An indication of whether the interval data type is a year-month interval or a day-time interval. - The <interval qualifier> that describes the precision of the interval data type. A value described by an interval data type descriptor is always signed. Every datetime or interval data type has an implied length in positions. Let D denote a value in some datetime or interval data type DT. The length in positions of DT is constant for all D. The length in positions is the number of characters from the character set SQL_TEXT that it would take to represent any value in a given datetime or interval data type. An approximation obtained by rounding of a datetime or interval value D for a <datetime type> or <interval type> T is a value V in T such that the absolute value of the difference between D and the numeric value of V is not greater than half the absolute value of the difference between two successive datetime or interval values in T. If there is more than one such value V, then it is implementation-defined which one is taken. 4.6.2 Intervals There are two classes of intervals. One class, called year-month intervals, has an express or implied datetime precision that includes no fields other than YEAR and MONTH , though not both are required. The other class, called day-time intervals, has an express or implied interval precision that can include any fields other than YEAR or MONTH . The actual subset of fields that comprise a value of either type of interval is defined by an <interval qualifier> and this subset is known as the precision of the value. Within a value of type interval, the first field is constrained only by the <interval leading field precision> of the associated <interval qualifier> . Table 6, "Valid values for fields in INTERVAL values", specifies the constraints on subsequent field values. Values in interval fields other than SECOND are integers and have precision 2 when not the first field. SECOND, however, can be defined to have an <interval fractional seconds precision> that indicates the number of decimal digits maintained following the decimal point in the seconds value. When not the first field, SECOND has a precision of 2 places before the decimal point. Fields comprising an item of type interval are also constrained by the definition of the Gregorian calendar. Year-month intervals are comparable only with other year-month intervals. If two year-month intervals have different interval precisions, they are, for the purpose of any operations between them, effectively converted to the same precision by appending new <primary datetime field> s to either the most significant end of one interval, the least significant end of one interval, or both. New least significant <primary datetime field> s are assigned a value of 0 (zero). When it is necessary to add new most significant datetime fields, the associated value is effectively converted to the new precision in a manner obeying the natural rules for dates and times associated with the Gregorian calendar. Day-time intervals are comparable only with other day-time intervals. If two day-time intervals have different interval precisions, they are, for the purpose of any operations between them, effectively converted to the same precision by appending new <primary datetime field> s to either the most significant end of one interval or the least significant end of one interval, or both. New least significant <primary datetime field> s are assigned a value of 0 (zero). When it is necessary to add new most significant datetime fields, the associated value is effectively converted to the new precision in a manner obeying the natural rules for dates and times associated with the Gregorian calendar.

The following features are supported:

- `Leading Qualifier`
- `Trailing Qualifier`
- `Leading Field Precision`
- `Trailing Field Precision`
- `Fractional Seconds Precision`

See Also:
  `SQLDataTypesPackage.getIntervalDataType()`

Method Summary
`int` `getFractionalSecondsPrecision()` Returns the value of the 'Fractional Seconds Precision' attribute.
`int` `getLeadingFieldPrecision()` Returns the value of the 'Leading Field Precision' attribute.
`IntervalQualifierType` `getLeadingQualifier()` Returns the value of the 'Leading Qualifier' attribute.
`int` `getTrailingFieldPrecision()` Returns the value of the 'Trailing Field Precision' attribute.
`IntervalQualifierType` `getTrailingQualifier()` Returns the value of the 'Trailing Qualifier' attribute.
`void` `setFractionalSecondsPrecision(int value)` Sets the value of the '`Fractional Seconds Precision`' attribute.
`void` `setLeadingFieldPrecision(int value)` Sets the value of the '`Leading Field Precision`' attribute.
`void` `setLeadingQualifier(IntervalQualifierType value)` Sets the value of the '`Leading Qualifier`' attribute.
`void` `setTrailingFieldPrecision(int value)` Sets the value of the '`Trailing Field Precision`' attribute.
`void` `setTrailingQualifier(IntervalQualifierType value)` Sets the value of the '`Trailing Qualifier`' attribute.

Methods inherited from interface org.eclipse.datatools.modelbase.sql.datatypes.PredefinedDataType
`getPrimitiveType, setPrimitiveType`

Methods inherited from interface org.eclipse.datatools.modelbase.sql.datatypes.DataType
`setContainer`

Methods inherited from interface org.eclipse.datatools.modelbase.sql.schema.SQLObject
`addEAnnotation, addEAnnotationDetail, getDependencies, getDescription, getEAnnotation, getEAnnotationDetail, getLabel, removeEAnnotationDetail, setAnnotationDetail, setDescription, setLabel`

Method Detail

### getLeadingQualifier

    public IntervalQualifierType getLeadingQualifier()

  Returns the value of the 'Leading Qualifier' attribute. The literals are from the enumeration `IntervalQualifierType`.

  If the meaning of the 'Leading Qualifier' attribute isn't clear, there really should be more of a description here...

  Returns:
    the value of the 'Leading Qualifier' attribute.
  See Also:
    `IntervalQualifierType`, `setLeadingQualifier(IntervalQualifierType)`, `SQLDataTypesPackage.getIntervalDataType_LeadingQualifier()`

### setLeadingQualifier

    public void setLeadingQualifier(IntervalQualifierType value)

  Sets the value of the '`Leading Qualifier`' attribute.

  Parameters:
    `value` - the new value of the 'Leading Qualifier' attribute.
  See Also:
    `IntervalQualifierType`, `getLeadingQualifier()`

### getTrailingQualifier

    public IntervalQualifierType getTrailingQualifier()

  Returns the value of the 'Trailing Qualifier' attribute. The literals are from the enumeration `IntervalQualifierType`.

  If the meaning of the 'Trailing Qualifier' attribute isn't clear, there really should be more of a description here...

  Returns:
    the value of the 'Trailing Qualifier' attribute.
  See Also:
    `IntervalQualifierType`, `setTrailingQualifier(IntervalQualifierType)`, `SQLDataTypesPackage.getIntervalDataType_TrailingQualifier()`

### setTrailingQualifier

    public void setTrailingQualifier(IntervalQualifierType value)

  Sets the value of the '`Trailing Qualifier`' attribute.

  Parameters:
    `value` - the new value of the 'Trailing Qualifier' attribute.
  See Also:
    `IntervalQualifierType`, `getTrailingQualifier()`

### getLeadingFieldPrecision

    public int getLeadingFieldPrecision()

  Returns the value of the 'Leading Field Precision' attribute.

  If the meaning of the 'Leading Field Precision' attribute isn't clear, there really should be more of a description here...

  Returns:
    the value of the 'Leading Field Precision' attribute.
  See Also:
    `setLeadingFieldPrecision(int)`, `SQLDataTypesPackage.getIntervalDataType_LeadingFieldPrecision()`

### setLeadingFieldPrecision

    public void setLeadingFieldPrecision(int value)

  Sets the value of the '`Leading Field Precision`' attribute.

  Parameters:
    `value` - the new value of the 'Leading Field Precision' attribute.
  See Also:
    `getLeadingFieldPrecision()`

### getTrailingFieldPrecision

    public int getTrailingFieldPrecision()

  Returns the value of the 'Trailing Field Precision' attribute.

  If the meaning of the 'Trailing Field Precision' attribute isn't clear, there really should be more of a description here...

  Returns:
    the value of the 'Trailing Field Precision' attribute.
  See Also:
    `setTrailingFieldPrecision(int)`, `SQLDataTypesPackage.getIntervalDataType_TrailingFieldPrecision()`

### setTrailingFieldPrecision

    public void setTrailingFieldPrecision(int value)

  Sets the value of the '`Trailing Field Precision`' attribute.

  Parameters:
    `value` - the new value of the 'Trailing Field Precision' attribute.
  See Also:
    `getTrailingFieldPrecision()`

### getFractionalSecondsPrecision

    public int getFractionalSecondsPrecision()

  Returns the value of the 'Fractional Seconds Precision' attribute.

  If the meaning of the 'Fractional Seconds Precision' attribute isn't clear, there really should be more of a description here...

  Returns:
    the value of the 'Fractional Seconds Precision' attribute.
  See Also:
    `setFractionalSecondsPrecision(int)`, `SQLDataTypesPackage.getIntervalDataType_FractionalSecondsPrecision()`

### setFractionalSecondsPrecision

    public void setFractionalSecondsPrecision(int value)

  Sets the value of the '`Fractional Seconds Precision`' attribute.

  Parameters:
    `value` - the new value of the 'Fractional Seconds Precision' attribute.
  See Also:
    `getFractionalSecondsPrecision()`

Copyright © 2006 Actuate, IBM Corporation, Sybase, Inc. and others. All rights reserved.