SQL command
The SQL command view initially consists of a single
editable area where the SQL query is entered.
The query is then evaluated, and if no errors were detected by the database server,
the view is split into two parts, with the bottom part displaying the list
of returned fields and their data types, as shown in the following figure:
Field names returned by the evaluation match the names of table columns that are explicitly or implicitly listed in the query. If the field does not have a name (e.g. a calculated or aggregated field), the name of the returned field is generated by Scribe as "varN", where N is the next available number for the local variable.
The retrieved fields are also loaded into the Retrieval component,
and the Main Resources tab view of the Palette:
The fields can be renamed, if desired, by editing them in the Palette.
Error diagnostics
If the query contains syntactical errors, the evaluation does not return any fields. Instead, an error message is displayed in the bottom part of the Inspector. The text and degree of detail of the message depends on the database server that runs the query; the example below shows the error message generated by Oracle database:
Variables in the SQL command
SQL query set in this view can be made more flexible by using
variables that will be replaced with their values at the run-time. The variables
names are enclosed in square brackets, and the evaluation of the SQL query
with variables requires the user to provide a sample value for each variable,
as shown in the following example: