Using the SQL SELECT statement and Interactive SQL, you can query a database on another iSeries™ server for data you need to create or update a table on the local server.
The SELECT statement allows you to specify the table name and columns containing the desired data, and selection criteria or filters that determine which rows of data are retrieved. If the SELECT statement is successful, the result is one or more rows of the specified table.
In addition to getting data from one table, SQL allows you to get information from columns contained in two or more tables in the same database by using a join operation. If the SELECT statement is successful, the result is one or more rows of the specified tables. The data values in the columns of the rows returned represent a composite of the data values contained in specified tables.
Using an Interactive SQL query, the results of a query can be placed in a database file on the local server. If a commitment control level is specified for the Interactive SQL process, it applies to the application server (AS); the database file on the local server is under a commitment control level of *NONE.
Interactive SQL allows you to do the following things:
Consider the situation in which the KC105 dealership is transferring its entire stock of part number 1234567 to KC110. KC110 queries the KC105 database for the part they acquire from KC105. The result of this inventory query is returned to a database file that already exists on the KC110 server. This is the process you can use to complete this task:
Use the Start SQL (STRSQL) command to get the Interactive SQL display. Before you enter any SQL statement (other than a CONNECT) for the new database, specify that the results of this operation are sent to a database file on the local server by doing the following steps:
When the database name is specified, you can begin your Interactive SQL processing as shown in the following example.
Enter SQL Statements Type SQL statement, press Enter. Current connection is to relational database KC000. CONNECT TO KC105__________________________________________________________ Current connection is to relational database KC105. ====> SELECT * FROM INVENTORY_____________________________________________ WHERE PART = '1234567'____________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ __________________________________________________________________________ Bottom F3=Exit F4=Prompt F6=Insert line F9=Retrieve F10=Copy line F12=Cancel F13=Services F24=More keys