Compilation Errors in Procedures and Functions v12
When the Advanced Server parsers compile a procedure or function, they confirm that both the CREATE
statement and the program body (that portion of the program that follows the AS
keyword) conforms to the grammar rules for SPL and SQL constructs. By default, the server will terminate the compilation process if a parser detects an error. Note that the parsers detect syntax errors in expressions, but not semantic errors (i.e. an expression referencing a non-existent column, table, or function, or a value of incorrect type).
spl.max_error_count
instructs the server to stop parsing if it encounters the specified number of errors in SPL code, or when it encounters an error in SQL code. The default value of spl.max_error_count
is 10
; the maximum value is 1000
. Setting spl.max_error_count
to a value of 1
instructs the server to stop parsing when it encounters the first error in either SPL or SQL code.
You can use the SET
command to specify a value for spl.max_error_count
for your current session. The syntax is:
Where number_of_errors
specifies the number of SPL errors that may occur before the server halts the compilation process. For example:
The example instructs the server to continue past the first five SPL errors it encounters. When the server encounters the sixth error it will stop validating, and print six detailed error messages, and one error summary.
To save time when developing new code, or when importing existing code from another source, you may want to set the spl.max_error_count
configuration parameter to a relatively high number of errors.
Please note that if you instruct the server to continue parsing in spite of errors in the SPL code in a program body, and the parser encounters an error in a segment of SQL code, there may still be errors in any SPL or SQL code that follows the erroneous SQL code. For example, the following function results in two errors:
The following example adds a SELECT
statement to the previous example. The error in the SELECT
statement masks the other errors that follow: