Populating a Queue Table - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

You populate a queue tables in the same way you populate non-queue tables: with INSERT statements, INSERT … SELECT statements, or using a load utility like Teradata Parallel Data Pump or Teradata Parallel Transporter (using the STREAM and INSERT operators) that generates those statements.

You can use a simple INSERT … SELECT statement to populate a queue table from either a queue- or a non-queue table. You can also use an INSERT … SELECT AND CONSUME statement to populate a queue table with rows from another queue table.

Do not insert the QITS value, because the system inserts it by default using the value for CURRENT_TIMESTAMP.

Similarly, you do not insert the QSN value if your queue table uses a system-generated identity column.

The source table for an INSERT … SELECT statement can be either another queue table or a non-queue table.

The following example ANSI session mode transaction uses an INSERT statement and multiple INSERT … SELECT requests to insert several rows into a queue table named shopping_cart.

    INSERT INTO shopping_cart (order_num, product, quantity)
    VALUES ('I07219100', 'dozen baseballs' , 1);

    INSERT INTO shopping_cart (order_num, product, quantity)
     SELECT order_num, product, quantity
      FROM mail_orders;

    INSERT INTO shopping_cart (order_num, product, quantity)
      SELECT order_num, product, quantity
      FROM backorder_tbl
      WHERE order_num = 'I00200314';

    COMMIT;