### Editing the SQL statements of a query

In the Query Editor window, if you click the SQL button (or the View > Edit SQL menu command), a window will then be displayed showing the SQL statements used to execute the query. See illustration.

You can edit the query statements in the text area as follows:

- To check whether it can be parsed back to the structured PSQL query correctly, click Parse. Whether the query statement is valid or not, a message box will be displayed to show you the result.
- To see whether it can be successfully processed, click Execute.
- To accept the changes you have made, click OK. JReport Designer will then parse and execute the query statements and dispose the Query Editor window.

Notes:

- If there are parameters in this query, their default values will be used to construct statement.
- If JReport Designer fails in parsing or restoring the query statements, a message box will be displayed asking you whether to apply the changes anyway. If you choose yes, a statement string will then be recorded in the PSQL query. However, after that, the structured statement may be not tally with the statement string.

#### Customized SQL mode

When creating a query using the Query Editor, JReport allows you to copy and paste your own SQL statement directly in the SQL window as explained above. However, because JReport query parser follows the SQL 92 standard, sometimes JReport is not able to parse the customized SQL statement. In this case, a warning message is displayed after you click the OK button in the SQL window asking whether to continue using the customized SQL statement. If you choose Yes, the customized SQL mode is enabled, in which all the functions in the Query Editor will be disabled, and you can only edit the query by modifying the SQL statement in the SQL window.

During the customized SQL mode, you can see the Customized SQL Mode option in the Query menu of the Query Editor is enabled and checked. By unchecking this option, you can go back to use functions of the Query Editor, in which case, the customized SQL statement will be lost and the SQL statement generated by JReport will be applied instead.

Note that you are required to guarantee the correctness of the customized SQL statement since JReport will not parse it.