Adaptive Server optimizes stored procedures when they are first executed (when values passed for variables are available). Adaptive Server releases prior to 15.0.2 compiled all statements in a stored procedure before the statements were executed. This meant that the actual values of local variables or knowledge of temporary tables created within the stored procedure were not available during optimization. The compiled stored procedure, including the plan, was placed in the procedure cache so that the next time it was executed the user did not need to spend time compiling and optimizing it again.