The {error}
and {/error} directive pair delimits the error section. The error
section is a part of the update section. In this section, you include
the HTML elements and htmSQL directives that you want htmSQL to process
when the previous SQL section completes with a nonzero return code.
When an SQL section
returns with a return code of zero, htmSQL ignores the error section.
If you want to submit
more SQL statements from within your error section, you can do one
of the following:
-
nest one or more SQL sections (with
accompanying {library} directive and success, error, and norows sections
when necessary) in the error section. All SQL statements are sent
to the data source that is specified by the encompassing {update}
directive.
-
nest a complete update section
in the error section, and use the {update} directive to specify a
different data source. The SQL, success, error, and norows sections
that are within the nested section will work with data from this new
data source.
-
nest a complete query section in
the error section to query data from the same data source or from
a different data source.
Note: htmSQL does not limit the
number of times that you can nest sections within error sections.
However, beyond a certain point, you might experience poor performance
or your system might run out of memory.