DB2 Server for VSE & VM: Interactive SQL Guide and Reference


Saving the Format Information

The formatting information performed while viewing the query result is always saved when the query does not contain placeholders. When the query contains placeholders, however, the formatting information is saved only if the placeholders are not in the SELECT or FROM clause. To illustrate how format information is saved, remove the placeholders and insert actual values into the SELECT and FROM clauses of MYQUERY, but retain the placeholder in the WHERE clause by typing:

   hold select * -
   from employee -
   where &1
 
   store myquery replace

Notice the keyword REPLACE; it instructs ISQL that the statement you are now storing replaces the previous version of MYQUERY. If the keyword REPLACE is not used, ISQL issues the warning message described earlier. Of course, you can choose another name and save both the old and new queries.

Now start MYQUERY and include the parameter that completes the WHERE clause:

   start myquery (empno='000010')

This processes the following statement:

   select * -
   from employee -
   where empno='000010'

Add formatting information to the query result. Type:

   format separator ' | '

End the query, and then save the formatting information by typing:

   store myquery replace

Start the query again, but substitute a different value for the placeholder:

   start myquery (empno='000150')

You see that the query result has retained the separator that you formatted and stored.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]