You may want to run some statements before or after the select statement for your report, e.g. to create a temporary table, create an index etc. Enter all your statements in the sql source section of the report, with each statement ending in a ;
and specify which statement should be used as the report's results by setting the Display Resultset field of the report.
Display ResultSet | Description |
---|---|
0 | The sql source doesn't contain multiple statements |
1, 2, ... n | Use the specified statement, with the first statement being 1 |
-1 | Use the select statement, regardless of how many statements exist |
-2 | Use the last statement, regardless of how many statements exist |
If you set the Display Resultset to -2 to use the last statement, ensure that your database driver is at least JDBC 3.0 compliant.
Some RDBMSs may require extra configuration to allow for execution of multiple statements in a query, and some may not support it at all.
RDBMS | Comment |
---|---|
SQL Server | No extra configuration needed |
PostgreSQL | No extra configuration needed |
MySQL | Add the property allowMultiQueries=true to the jdbc url of the query's datasource e.g. jdbc:mysql://localhost/mydb?allowMultiQueries=true |
CUBRID | Driver is JDBC 2.0 compliant so don't use the -2 option |
Oracle | Not supported |
HSQLDB | Not supported |
Discussion: Update Statement - Processing Results shows 0 rows updated