15.00 - Populating a Queue Table - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1184-015K

Populating a Queue Table

You populate a queue tables in the same way you populate non‑queue tables: with INSERT requests, INSERT … SELECT requests, 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 request to populate a queue table from either a queue‑ or a non‑queue table. You can also use an INSERT … SELECT AND CONSUME request 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 request can be either another queue table or a non‑queue table.

The following example ANSI session mode transaction uses an INSERT request 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;