Identifies a field as an INTERVAL value defining a period of time in hours and minutes.
Syntax
INTERVAL HOUR [ ( precision ) ] TO MINUTE [ attributes [...] ]
- precision
- The permitted range of digits for HOUR, ranging from one to four.
- attributes
- Appropriate data type, column storage, or column constraint attributes.
ANSI Compliance
INTERVAL HOUR TO MINUTE is ANSI SQL:2011 compliant.
Internal Representation of INTERVAL HOUR TO MINUTE
Field | Storage Format | Total Length |
---|---|---|
HOUR | SMALLINT | 4 bytes |
MINUTE | SMALLINT |
External Representation of INTERVAL HOUR TO MINUTE
INTERVAL HOUR TO MINUTE types are imported and exported in record and indicator modes as CHARACTER data using the client character set.
Type | Format |
---|---|
CHARACTER(precision + 4) | '-h(precision):mm' |
For example, for INTERVAL HOUR(2) TO MINUTE, a value might be ' 17:37 '.
Range of Values
The range of values for INTERVAL HOUR TO MINUTE is as follows.
Type and Precision | Minimum Value | Maximum Value |
---|---|---|
INTERVAL HOUR(1) TO MINUTE | -'9:59' | '9:59' |
INTERVAL HOUR(2) TO MINUTE | -'99:59' | '99:59' |
INTERVAL HOUR(3) TO MINUTE | -'999:59' | '999:59' |
INTERVAL HOUR(4) TO MINUTE | -'9999:59' | '9999:59' |
Implicit and Explicit INTERVAL HOUR TO MINUTE 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 HOUR TO MINUTE Data Type
The following statement creates a table with an INTERVAL HOUR TO MINUTE column:
CREATE TABLE TimeInfo (Id INTEGER ,Offset INTERVAL HOUR (4) TO MINUTE);