


The call of a stored command is marked by the keyword QUERY. As in the command line of QUERY (cf. manual ADABAS QUERY) the call is made by means of the QUERY keyword RUN, the name of the stored command as well as any necessary parameters.
SQL-PL allows the static or dynamic specification of the call.
In the case of a static specification, the optional keyword CMD is followed by the call enclosed in parentheses. Parameters that stand for values in the stored command can be specified by variables from SQL-PL. Variables must be identified by a ':' prefix. They are replaced by their current values (number or string enclosed in single quotes) before calling the stored command. Parameters standing for names (e.g. of tables or columns) must be explicitly specified. The syntax of the call is checked by the compiler. The usage relations between the SQL-PL module and the stored command (QUERY COMMAND) are maintained if the workbench option USAGE is set.
In the case of a dynamic specification of the call, the necessary keyword EXECUTE is followed by an expression that is evaluated and interpreted as a call command at execution time. Therefore a check cannot be made at compile time. The usage relation between the SQL-PL module and the command is not maintained either.
Stored commands of other users can be called if the user has a corresponding access privilege.
Examples:


Note: If the name of the QUERY command contains lower case letters or special characters in QUERY, the name must be protected by " (double quotes) when calling it from sql-pl in the same way as when storing it in QUERY. This also applies to the user name.

The total length of the call command in parentheses must not exceed 139 characters after substituting the variables. The total length can only be checked at execution time. If the maximum value is exceeded, an error is reported.
After executing the SQL statement in the stored command, the current database transaction is implicitly terminated (COMMIT). If the module option AUTOCOMMIT OFF is set in the routine in which the stored command is called, the database transaction must be terminated explicitly by the application programmer (cf. "module options (autocommit off)").
Syntax:



