The application sends the statements composing a procedure to the database, where they are compiled and saved for subsequent execution. The application that creates the procedure must do the following:
- Ascertain whether the database supports stored procedures.
- Send a request containing the procedure that could exceed the maximum parcel size.
- Provide compilation options to the database.
To ascertain if the database supports stored procedures, the DBCHQE CLIv2-limits query (or the deprecated Maximum-segment-size query) is used. If the segment length value returned by CLIv2-limits is zero, then SQL Stored Procedures are not supported (the deprecated Maximum-segment-size query fails with a return code 359 if such procedures are not supported).