An SQL procedure deployment system deploys a query procedure comprising a
procedural logic component and a database request component from a source
system to a target system. At generation of the query procedure, the
system generates a query procedure source code, a symbol table, and an
encapsulated optimization results to regenerate run-time instructions for
query statements of the database request component and make the query
statements function with a deployed procedural logic component. The
system maintains an association between the procedural logic component
and the database request component during deployment. The system copies
an internal representation of the procedural logic component to the
target system without regeneration. The system regenerates the database
request component to recreate the query procedure on the target system
and to maintain a consistent interface between the procedural logic
component and database request component.