Example 2: reading a DB2 table sequentially with the -query option

An example showing the db2read operator using an SQL query to read a DB2® table.

As in Example 1 above, this query reads a DB2 table named table_1. In this example, the query explicitly specifies three columns to read from the table, itemNum, price, and storeID. The read operation is executed sequentially. This is the default execution mode of db2read when the -query option is chosen.

Here is the osh syntax for this example:


$ osh "db2read -query 'select itemNum, price, storeID from table_1'        ..."