Insert Data into a Nonsequenced Table Examples | Teradata Vantage - Examples: Inserting Data into a Nonsequenced Table - Advanced SQL Engine - Teradata Database

Time Series Tables and Operations

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
cxa1555383531762.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1208
lifecycle
previous
Product Category
Teradata Vantageā„¢

Examples: INSERT into a Nonsequenced Table

The INSERT values list begins with the TD_TIMECODE column value, then buoyid and temperature. The inserts can be in any order. You do not have to perform the inserts in time sequence order. The system automatically generates a TD_TIMEBUCKET value for each insert row. You do not supply a value for TD_TIMEBUCKET column.

INSERT INTO ocean_buoy_no_seq(TIMESTAMP '2017-01-06 10:32:12.123456', 111, 50);
INSERT INTO ocean_buoy_no_seq(TIMESTAMP '2017-01-06 10:32:12.123456', 111, 60);
INSERT INTO ocean_buoy_no_seq(TIMESTAMP '2017-01-06 10:44:15.123456', 111, 60);
INSERT INTO ocean_buoy_no_seq(TIMESTAMP '2017-01-06 10:39:10.123456', 111, 50);
INSERT INTO ocean_buoy_no_seq(TD_TIMECODE, buoyid, temperature) VALUES (TIMESTAMP '2020-01-06 10:32:12.123456', 111,  50);
INSERT INTO ocean_buoy_no_seq(TD_TIMECODE, buoyid, temperature) VALUES (TIMESTAMP '2020-01-06 10:42:22.123456', 222,  60);
INSERT INTO ocean_buoy_no_seq(TD_TIMECODE, buoyid, temperature) VALUES (TIMESTAMP '2020-01-06 10:40:20.123456', 333,  70);

Examples: Invalid INSERT into a Nonsequenced Table

You cannot insert into the TD_TIMEBUCKET column. The following statements return an error.

INSERT INTO ocean_buoy_no_seq(, TIMESTAMP '2017-01-06 10:32:12.123456', 111, 50);
INSERT INTO ocean_buoy_no_seq(55, TIMESTAMP '2017-01-06 10:32:12.123456', 111, 50);

You cannot use CURRENT_TIMESTAMP as an insert value into the TD_TIMECODE column. The following statement returns an error.

INSERT INTO ocean_buoy_no_seq(CURRENT_TIMESTAMP, 111, 50);

You must specify a value for the TD_TIMECODE column. The following statement returns an error.

INSERT INTO ocean_buoy_no_seq( , 111, 50);