Insert Data into a Nonsequenced Table Examples | Teradata Vantage - 17.00 - Examples: Inserting Data into a Nonsequenced Table - Teradata Database

Teradata Vantageā„¢ - Time Series Tables and Operations

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
created_date
June 2020
category
Programming Reference
featnum
B035-1208-170K

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);