What specifies semi colon as statement separators on CRTQMQRY and STRQMQRY commands

410 Views Asked by At

When running multiline SQL code with semi colon as sql statement separators the following errors:

CRTQMQRY QMQRY(MYPGMLIB/MYSQL) SRCFILE(MYLIB/QSQLSRC)
STRQMQRY QMQRY(MYPGMLIB/MYSQL)

Whereas the following works:

RUNSQLSTM SRCFILE(MYPGMLIB/QSQLSRC) SRCMBR(MYSQL) COMMIT(*NONE)

I've googled the options on CRTQMQRY and STRQMQRY but cannot find anything that specifies statement separator.

2

There are 2 best solutions below

1
On BEST ANSWER

Query Manager (QM) does not support multiple statements per member.

Use RUNSQLSTM.

1
On

If multiple queries are needed in a collected group of statements, you can use RUNSQLSTM. If they have logical connections, you might code them into a DB2 stored procedure.

If you want to do them with Query Management, e.g., to be run with the STRQMQRY command, you'll need to create a QM PROC. See the DB2 Universal Database for iSeries Query Management Programming manual (PDF). Although QM can be powerful,very few learn about QM PROCs under DB2 for i. QM to that level is more common on mainframes and even on PCs.