The following example shows you how to use the list function to build a SELECT statement.
Assume you have:
Begin using SQL statements:
Enter SQL Statements Type SQL statement, press Enter. ===> SELECT FROM _
Instead of a list of tables appearing as you expected, a list of collections appears (the Select and Sequence collections display). You have just entered the SQL session and have not selected a schema to work with.
Select and Sequence Collections Type sequence numbers (1-999) to select collection, press Enter. Seq Collection Type Text YOURCOLL1 SYS Company benefits 1 YOURCOLL2 SYS Employee personal data YOURCOLL3 SYS Job classifications/requirements YOURCOLL4 SYS Company insurances
The Select and Sequence Tables display appears, showing the tables existing in the YOURCOLL2 schema.
Select and Sequence Tables Type sequence numbers (1-999) to select tables, press Enter. Seq Table Collection Type Text EMPLCO YOURCOLL2 TAB Employee company data 1 PEOPLE YOURCOLL2 TAB Employee personal data EMPLEXP YOURCOLL2 TAB Employee experience EMPLEVL YOURCOLL2 TAB Employee evaluation reports EMPLBEN YOURCOLL2 TAB Employee benefits record EMPLMED YOURCOLL2 TAB Employee medical record EMPLINVST YOURCOLL2 TAB Employee investments record
The Enter SQL Statements display appears again with the table name, YOURCOLL2.PEOPLE, inserted after FROM. The table name is qualified by the schema name in the *SQL naming convention.
Enter SQL Statements Type SQL statement, press Enter. ===> SELECT FROM YOURCOLL2.PEOPLE _
The Select and Sequence Columns display appears, showing the columns in the PEOPLE table.
Select and Sequence Columns Type sequence numbers (1-999) to select columns, press Enter. Seq Column Table Type Digits Length 2 NAME PEOPLE CHARACTER 6 EMPLNO PEOPLE CHARACTER 30 1 SOCSEC PEOPLE CHARACTER 11 STRADDR PEOPLE CHARACTER 30 CITY PEOPLE CHARACTER 20 ZIP PEOPLE CHARACTER 9 PHONE PEOPLE CHARACTER 20
The Enter SQL Statements display appears again with SOCSEC, NAME appearing after SELECT.
Enter SQL Statements Type SQL statement, press Enter. ===> SELECT SOCSEC, NAME FROM YOURCOLL2.PEOPLE
The statement you created is now run.
Once you have used the list function, the values you selected remain in effect until you change them or until you change the list of schemas on the Change Session Attributes display.