You cannot specify the TD_TimeBucket column in the WHERE clause of the DELETE statement. For complete information about DELETE syntax, see Teradata Vantage™ SQL Data Manipulation Language , B035-1146 .
Example: DELETE Rows from a PTI Table
Below is the table definition for this example:
CREATE TABLE ocean_buoy ( TD_TIMEBUCKET BIGINT NOT NULL GENERATED SYSTEM TIMECOLUMN, TD_TIMECODE TIMESTAMP(1) NOT NULL GENERATED TIMECOLUMN, BUOY_ID INTEGER, TEMPERATURE INTEGER) PRIMARY TIME INDEX (TIMESTAMP(1), DATE '2016-10-15', HOURS(1), NONSEQUENCED);
These statements add data to the table:
INSERT INTO ocean_buoy(TIMESTAMP '2016-10-16 10:33:12.1', 1, 33); INSERT INTO ocean_buoy(TIMESTAMP '2016-10-16 11:44:12.1', 2, 34); INSERT INTO ocean_buoy(TIMESTAMP '2016-10-16 12:55:12.1', 3, 35);
This statement deletes the last inserted row:
DELETE FROM ocean_buoy WHERE TD_TIMECODE = TIMESTAMP '2016-10-16 12:55:12.1';