Collapse AllExpand All

2.4. Parsing and Executing a Query

Before we execute our query, we must first parse it using the MetaSQL parser. As we have discussed previously, the MetaSQL parser interprets MetaSQL statements embedded in a query, evaluates the available parameters, and then produces standard SQL. The resulting standard SQL is then sent to the database for processing.

To parse select the Parse Query option from the Tools menu. The following screen will appear:

Parsed query in MetaSQL Editor

Notice that the MetaSQL parser creates a Log Output screen, where messages related to the parsing process will be written. In our case, we get a "Query parsed." message, which means our MetaSQL was parsed successfully.

Once a query has been parsed, we are ready to execute it. Executing a query means the standard SQL produced by the MetaSQL parser is sent to the database for processing. To execute a query, select the Execute Query option from the Tools menu. The following screen will appear:

Results of executed query

When a query is executed successfully, the results will be displayed in a Results Output screen. As you can see in the example, the value returned in the item_number column equals the value assigned to the parameter item_code.