Using the SQL Text view

The SQL Text view of the Query Editor shows the text of the query in SQL. The SQL Text view is most useful to skilled programmers, for modifying queries. If you have existing queries created outside of QMF Visionary that you want to use in a world, you can copy them into the SQL Text view.

The following figure shows the SQL Text view displaying an SQL query.

Editing guidelines

You can include comments in the SQL Text view, but if you subsequently open the query in the Query Diagram view, the components might be removed. One-line comments must begin with two hyphens (--); multiline comments must begin with a slash and star (/*) and end with a star and slash (*/). Keywords are blue and comments are green. Query parameters are receded by a colon.

Using query clauses

The SQL Text view supports some query clauses that the Query Diagram view does not support. See the DB2 QMF Visionary Developer's Guide for more information.

Calling stored procedures

The SQL Text view supports the use of stored procedures that generate a result set. To call a stored procedure, use on

e of the following keywords:

Specifying multiple SQL statements

The SQL Text view supports multiple SQL statements. If multiple SQL statements are executed, QMF Visionary uses the last Select/CallData statement in the query for the query result set. The following example shows a query with multiple SQL statements:

Create table xyz...;
Call mystoredproc 'param1', param2;
CallData mydatasproc param1, param2, 'param3';
Drop table xyz;

The above SQL contains four separate statements. The first two statements are considered setup statements. The third statement is considered the results bearing statement. The last statement is considered the clean up statement.

[ Previous Page | Next Page | Contents | Index ]