Populating a Queue Table - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
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;