SELECT AND CONSUME Subqueries in INSERT Requests - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
SELECT AND CONSUME is only supported on the Block File System on the primary cluster. It is not available for the Object File System.

An INSERT operation can use a SELECT AND CONSUME subquery to insert data from the row with the lowest value in the QITS column in the specified queue table and delete the row from the queue table.

The target table for the INSERT operation can be a base table or a queue table. If the target is a queue table, it can be the same queue table in the SELECT AND CONSUME subquery.

The SELECT AND CONSUME part of the request behaves like a regular SELECT AND CONSUME request. See SELECT AND CONSUME.

When the target table is a queue table, the INSERT part of the request behaves like an INSERT into a queue table. See Inserting Rows into Queue Tables.

Certain restrictions apply to triggers. An INSERT operation that uses a SELECT AND CONSUME subquery cannot be used as either of the following:
  • Triggering event statement that fires a trigger.
  • Triggered action statement fired by a triggering event.