Pump

A pump is a SQLstream s-Server repository object that provides a continuously running INSERT INTO stream SELECT … FROM query functionality, thereby enabling the results of a query to enter a named stream.

A pump wraps around a standard SQL INSERT INTO or SELECT FROM query, but gives this query an execution context.

The example below first creates and sets the schema “Test”, then creates two streams, “OrderDataWithCreateTime” and “OrderData”, then creates a pump that selects from the first stream and inserts into the second stream.

CREATE OR REPLACE SCHEMA "Test";
SET SCHEMA '"Test"';

CREATE OR REPLACE STREAM "OrderDataWithCreateTime" (
"key_order" VARCHAR(20),
"key_user" VARCHAR(20),
"key_billing_country" VARCHAR(20),
"key_product" VARCHAR(20),
"quantity" INTEGER,
"eur" DOUBLE,
"usd" DOUBLE)
DESCRIPTION 'Creates origin stream for pump';

CREATE OR REPLACE STREAM "OrderData" (
"key_order" VARCHAR(20),
"key_user" VARCHAR(20),
"country" VARCHAR(20),
"key_product" VARCHAR(20),
"quantity" INTEGER,
"eur" DOUBLE,
"usd" DOUBLE)
DESCRIPTION 'Creates destination stream for pump';

CREATE OR REPLACE PUMP "200-ConditionedOrdersPump" STOPPED AS
INSERT INTO "OrderData" (

"key_order", "key_user", "country",
"key_product", "quantity", "eur", "usd")

SELECT STREAM
"key_order", "key_user", "key_billing_country",
"key_product", "quantity", "eur", "usd"
FROM "OrderDataWithCreateTime";