Identifies a field as an INTERVAL value defining a period of time in months.
Syntax
INTERVAL MONTH [ ( precision ) ] [ attributes [...] ]
- precision
- The permitted range of digits for MONTH, ranging from one to four.
- attributes
- Appropriate data type, column storage, or column constraint attributes.
ANSI Compliance
INTERVAL MONTH is ANSI SQL:2011 compliant.
Internal Representation of INTERVAL MONTH
Storage Format | Length |
---|---|
SMALLINT | 2 bytes |
External Representation of INTERVAL MONTH
INTERVAL MONTH types are imported and exported in record and indicator modes as CHARACTER data using the client character set.
Type | Format |
---|---|
CHARACTER(precision + 1) | '-m(precision)' |
For example, for INTERVAL MONTH(4), the value might be something like ' 1300'.
Range of Values
The range of values for INTERVAL MONTH is as follows.
Type and Precision | Minimum Value | Maximum Value |
---|---|---|
INTERVAL MONTH(1) | -'9' | '9' |
INTERVAL MONTH(2) | -'99' | '99' |
INTERVAL MONTH(3) | -'999' | '999' |
INTERVAL MONTH(4) | -'9999' | '9999' |
Implicit and Explicit INTERVAL MONTH Conversion
Teradata Database performs implicit conversion from one Interval data type to another Interval type in some cases. You can also use CAST to explicitly convert one Interval type to another.
Conversions are possible only within the same INTERVAL family. For example, you may convert a YEAR interval to months, but not to days or hours.
For more information, see “Data Type Conversions” in Teradata Vantage™ - SQL Functions, Expressions, and Predicates, B035-1145.
Example: INTERVAL MONTH Data Type
The following statement creates a table with an INTERVAL MONTH column:
CREATE TABLE TimeInfo (Id INTEGER ,Offset INTERVAL MONTH (4));